# sanrish-lan/unixlab1 architecture

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

- Interactive diagram: https://gitdiagram.com/sanrish-lan/unixlab1
- Repository: https://github.com/sanrish-lan/unixlab1

## Overview

This repository is a collection of independent operating-systems and Unix lab exercises, not one integrated application. The visible workflows include synchronized packet passing, a signal-aware TCP server, a procfs kernel module, file deduplication, and a Kafka-backed URL-check service. The API publishes to `safe_tasks`, while the worker subscribes to `url_checks`; the excerpts do not establish that these topics are connected. The tree also contains `unixlab2/worker.sh`, but its behavior is unsampled, so its relationships are omitted.

Main entry points: [`unixlab4/api/main.py`](https://github.com/sanrish-lan/unixlab1/blob/main/unixlab4/api/main.py) (Check API), [`unixlab4/worker/worker.py`](https://github.com/sanrish-lan/unixlab1/blob/main/unixlab4/worker/worker.py) (URL worker), [`oslab1/main.cpp`](https://github.com/sanrish-lan/unixlab1/blob/main/oslab1/main.cpp) (Message queue), [`oslab2/main.cpp`](https://github.com/sanrish-lan/unixlab1/blob/main/oslab2/main.cpp) (TCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_os["OS exercises"]
  node_sender["Packet sender<br/>[main.cpp]"]
  node_queue["Message queue<br/>[main.cpp]"]
  node_receiver["Packet receiver<br/>[main.cpp]"]
  node_tcp_client(("TCP client"))
  node_signal_sender(("Signal sender"))
  node_tcp_server["TCP server<br/>[main.cpp]"]
  node_module_one["Kernel greeting module<br/>[module_1_part.c]"]
  node_uranus_module["Uranus proc module<br/>[module_2_part.c]"]
  node_proc_reader(("Procfs reader"))
end

subgraph group_unix["Unix utilities"]
  node_unix2_worker["Shell worker<br/>[worker.sh]"]
  node_deduplicator["File deduplicator<br/>[main.cpp]"]
  node_file_tree[("File system")]
end

subgraph group_url["URL checking"]
  node_api_client(("API client"))
  node_check_api["Check API<br/>[main.py]"]
  node_kafka["Kafka broker"]
  node_url_worker["URL worker<br/>[worker.py]"]
  node_website(("Target website"))
end

node_sender -->|"sends packets"| node_queue
node_receiver -->|"receives packets"| node_queue
node_tcp_client -.->|"connects and sends"| node_tcp_server
node_signal_sender -->|"sends SIGHUP"| node_tcp_server
node_proc_reader -.->|"reads proc entry"| node_uranus_module
node_deduplicator -->|"scans and replaces"| node_file_tree
node_api_client -.->|"posts URL"| node_check_api
node_check_api -->|"publishes task"| node_kafka
node_kafka -->|"delivers messages"| node_url_worker
node_url_worker -->|"requests URL"| node_website

click node_sender "https://github.com/sanrish-lan/unixlab1/blob/main/oslab1/main.cpp"
click node_queue "https://github.com/sanrish-lan/unixlab1/blob/main/oslab1/main.cpp"
click node_receiver "https://github.com/sanrish-lan/unixlab1/blob/main/oslab1/main.cpp"
click node_tcp_server "https://github.com/sanrish-lan/unixlab1/blob/main/oslab2/main.cpp"
click node_module_one "https://github.com/sanrish-lan/unixlab1/blob/main/oslab3/module_1_part.c"
click node_uranus_module "https://github.com/sanrish-lan/unixlab1/blob/main/oslab3/module_2_part.c"
click node_unix2_worker "https://github.com/sanrish-lan/unixlab1/blob/main/unixlab2/worker.sh"
click node_deduplicator "https://github.com/sanrish-lan/unixlab1/blob/main/unixlab3/main.cpp"
click node_check_api "https://github.com/sanrish-lan/unixlab1/blob/main/unixlab4/api/main.py"
click node_url_worker "https://github.com/sanrish-lan/unixlab1/blob/main/unixlab4/worker/worker.py"

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_sender,node_queue,node_receiver,node_tcp_client,node_signal_sender,node_tcp_server,node_module_one,node_uranus_module,node_proc_reader toneBlue
class node_unix2_worker,node_deduplicator,node_file_tree toneAmber
class node_api_client,node_check_api,node_kafka,node_url_worker,node_website toneMint
```

## Components

### OS exercises

- [Packet sender](https://github.com/sanrish-lan/unixlab1/blob/main/oslab1/main.cpp): `oslab1/main.cpp`
- [Message queue](https://github.com/sanrish-lan/unixlab1/blob/main/oslab1/main.cpp): `oslab1/main.cpp`
- [Packet receiver](https://github.com/sanrish-lan/unixlab1/blob/main/oslab1/main.cpp): `oslab1/main.cpp`
- **TCP client**
- **Signal sender**
- [TCP server](https://github.com/sanrish-lan/unixlab1/blob/main/oslab2/main.cpp): `oslab2/main.cpp`
- [Kernel greeting module](https://github.com/sanrish-lan/unixlab1/blob/main/oslab3/module_1_part.c): `oslab3/module_1_part.c`
- [Uranus proc module](https://github.com/sanrish-lan/unixlab1/blob/main/oslab3/module_2_part.c): `oslab3/module_2_part.c`
- **Procfs reader**

### Unix utilities

- [Shell worker](https://github.com/sanrish-lan/unixlab1/blob/main/unixlab2/worker.sh): `unixlab2/worker.sh`
- [File deduplicator](https://github.com/sanrish-lan/unixlab1/blob/main/unixlab3/main.cpp): `unixlab3/main.cpp`
- **File system**

### URL checking

- **API client**
- [Check API](https://github.com/sanrish-lan/unixlab1/blob/main/unixlab4/api/main.py): `unixlab4/api/main.py`
- **Kafka broker**
- [URL worker](https://github.com/sanrish-lan/unixlab1/blob/main/unixlab4/worker/worker.py): `unixlab4/worker/worker.py`
- **Target website**

## Connections

- Packet sender → Message queue: sends packets (evidence: `oslab1/main.cpp`)
- Packet receiver → Message queue: receives packets (evidence: `oslab1/main.cpp`)
- TCP client → TCP server: connects and sends
- Signal sender → TCP server: sends SIGHUP (evidence: `oslab2/main.cpp`)
- Procfs reader → Uranus proc module: reads proc entry
- File deduplicator → File system: scans and replaces (evidence: `unixlab3/main.cpp`)
- API client → Check API: posts URL
- Check API → Kafka broker: publishes task (evidence: `unixlab4/api/main.py`)
- Kafka broker → URL worker: delivers messages (evidence: `unixlab4/worker/worker.py`)
- URL worker → Target website: requests URL (evidence: `unixlab4/worker/worker.py`)
