# mayank24343/os_assignment2_group_60 architecture

> Architecture diagram of the GitHub repository mayank24343/os_assignment2_group_60, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mayank24343/os_assignment2_group_60
- Repository: https://github.com/mayank24343/os_assignment2_group_60

## Overview

SimpleShell is a small interactive Unix shell. The main workflow reads a command, records it, dispatches it for built-in or external execution, waits for completion, and retains process timing for display. Its principal execution branches are single commands and pipelines; history display and SIGINT cleanup are supporting capabilities. The runtime is implemented in one source file, so several components share its path.

Main entry points: [`shell.c`](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c) (Command dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Shell interaction"]
  node_loop["Shell loop<br/>[shell.c]"]
  node_launcher["Command launcher<br/>[shell.c]"]
  node_signal_handler["SIGINT handler<br/>[shell.c]"]
end

subgraph group_execution["Command execution"]
  node_dispatcher["Command dispatcher<br/>[shell.c]"]
  node_argument_parser["Argument parser<br/>[shell.c]"]
  node_cd["Directory change<br/>[shell.c]"]
  node_history_command["History command<br/>[shell.c]"]
  node_single_process["Single process<br/>[shell.c]"]
  node_pipeline["Pipeline execution<br/>[shell.c]"]
end

subgraph group_tracking["History and tracking"]
  node_history_store[("History array<br/>[shell.c]")]
  node_history_display["History display<br/>[shell.c]"]
  node_process_info["Process display<br/>[shell.c]"]
  node_cleanup["History cleanup<br/>[shell.c]"]
end

node_user(("User"))
node_unix_commands["Unix commands"]

node_user -->|"enters commands"| node_loop
node_loop -->|"launches command"| node_launcher
node_launcher -->|"calls"| node_dispatcher
node_dispatcher -->|"parses arguments"| node_argument_parser
node_dispatcher -->|"handles cd"| node_cd
node_dispatcher -->|"handles history"| node_history_command
node_dispatcher -->|"forks command"| node_single_process
node_dispatcher -->|"runs pipeline"| node_pipeline
node_single_process -->|"executes via execvp"| node_unix_commands
node_pipeline -->|"executes via execvp"| node_unix_commands
node_loop -->|"records command"| node_history_store
node_dispatcher -->|"records process data"| node_history_store
node_history_command -->|"calls"| node_history_display
node_history_display -->|"reads entries"| node_history_store
node_loop -->|"displays on exit"| node_process_info
node_process_info -->|"reads process data"| node_history_store
node_signal_handler -->|"displays details"| node_process_info
node_signal_handler -->|"calls"| node_cleanup
node_loop -->|"cleans on return"| node_cleanup
node_cleanup -->|"frees PID data"| node_history_store

click node_loop "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_launcher "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_dispatcher "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_argument_parser "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_cd "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_history_command "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_single_process "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_pipeline "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_history_store "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_history_display "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_process_info "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_signal_handler "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"
click node_cleanup "https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_loop,node_launcher,node_signal_handler,node_user toneBlue
class node_dispatcher,node_argument_parser,node_cd,node_history_command,node_single_process,node_pipeline toneAmber
class node_history_store,node_history_display,node_process_info,node_cleanup toneMint
class node_unix_commands toneIndigo
```

## Components

### Shell interaction

- [Shell loop](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [Command launcher](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [SIGINT handler](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`

### Command execution

- [Command dispatcher](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [Argument parser](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [Directory change](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [History command](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [Single process](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [Pipeline execution](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`

### History and tracking

- [History array](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [History display](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [Process display](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`
- [History cleanup](https://github.com/mayank24343/os_assignment2_group_60/blob/main/shell.c): `shell.c`

### Other components

- **User**
- **Unix commands**

## Connections

- User → Shell loop: enters commands (evidence: `README.md`)
- Shell loop → Command launcher: launches command (evidence: `shell.c`)
- Command launcher → Command dispatcher: calls (evidence: `shell.c`)
- Command dispatcher → Argument parser: parses arguments (evidence: `shell.c`)
- Command dispatcher → Directory change: handles cd (evidence: `shell.c`)
- Command dispatcher → History command: handles history (evidence: `shell.c`)
- Command dispatcher → Single process: forks command (evidence: `shell.c`)
- Command dispatcher → Pipeline execution: runs pipeline (evidence: `shell.c`)
- Single process → Unix commands: executes via execvp (evidence: `shell.c`)
- Pipeline execution → Unix commands: executes via execvp (evidence: `shell.c`)
- Shell loop → History array: records command (evidence: `shell.c`)
- Command dispatcher → History array: records process data (evidence: `shell.c`)
- History command → History display: calls (evidence: `shell.c`)
- History display → History array: reads entries (evidence: `shell.c`)
- Shell loop → Process display: displays on exit (evidence: `shell.c`)
- Process display → History array: reads process data (evidence: `shell.c`)
- SIGINT handler → Process display: displays details (evidence: `shell.c`)
- SIGINT handler → History cleanup: calls (evidence: `shell.c`)
- Shell loop → History cleanup: cleans on return (evidence: `shell.c`)
- History cleanup → History array: frees PID data (evidence: `shell.c`)
