# miryala10sathvika/xv-6-and-networking architecture

> Architecture diagram of the GitHub repository miryala10sathvika/xv-6-and-networking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/miryala10sathvika/xv-6-and-networking
- Repository: https://github.com/miryala10sathvika/xv-6-and-networking

## Overview

##### Project type and purpose
- This repo is not a single deployed application but a collection of coursework/lab components:
- “graphs”: Python-based graph-generation for scheduler data
- “initial-xv6”: a RISC-V port of the xv6 teaching OS (monolithic kernel + userland)
- “networks”: C implementations of basic TCP/UDP clients/servers, RPC over TCP/UDP, and a reliable transport protocol (parts A & B)
- “tester”: scripts to automate building and testing the xv6 image
- The root README focuses on a custom TCP-like transport and flow-control design (networks lab).

##### File structure
- Top-level folders group independent subprojects (graphs, initial-xv6, networks, tester).
- “initial-xv6/src/kernel” vs. “initial-xv6/src/user” signals a monolithic kernel with user processes.
- “networks/partA” & “networks/partB” separate different networking exercises (basic, RPC, reliable transport).
- Build scripts: Makefiles in initial-xv6, Python in graphs, shell scripts in tester.
- Configuration: xv6 uses its own Makefile and fs.img; networks C code compiled via gcc.

##### README for additional insights
- The root README outlines how the custom transport deviates from real TCP (fixed ISN, fixed timer, no dynamic window).
- It also proposes enhancements (add window field, RTT estimation, slow-start, congestion control heuristics).

##### Detail without overthinking
- Break each subproject into logical blocks (e.g., “Kernel: fs, proc, trap, virtio”, “Net: basic transport, RPC stub, reliable layer”).
- How data and control cross boundaries (syscalls, network sockets, script-→build).
- Custom protocol tweaks (fixed ISN, fixed timer, proposed window-field).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Graphs Module
    subgraph "Graphs Module" 
        direction TB
        GraphsScript["Python Script"]:::tooling
        SchedulerData["scheduler_data.txt"]:::artifact
        GraphsScript -->|reads| SchedulerData
    end

    %% xv6 OS Components
    subgraph "xv6 OS" 
        direction TB
        subgraph "Boot Flow" 
            direction TB
            Entry["Bootloader & Entry"]:::xv6
            KernelInit["Kernel Initialization"]:::xv6
            Entry --> KernelInit
        end
        subgraph "Monolithic Kernel" 
            direction TB
            Subsystems["Core Subsystems"]:::xv6
        end
        subgraph "Userland" 
            direction TB
            UserPrograms["Userland Programs"]:::xv6
        end
        subgraph "mkfs Tool" 
            direction TB
            MkfsSource["mkfs.c"]:::xv6
            MkfsBinary["mkfs"]:::xv6
            MkfsSource --> MkfsBinary
        end
        KernelInit --> Subsystems
        Subsystems --> UserPrograms
        MkfsBinary -->|produces| FsImg["fs.img"]:::artifact
        FsImg --> KernelInit
    end

    %% Tester Harness
    subgraph "Tester Harness" 
        direction TB
        RunTests["run-tests.sh"]:::tooling
        RunXv6Cmd["run-xv6-command.exp"]:::tooling
        EditMakefile["xv6-edit-makefile.sh"]:::tooling
        RunTests -->|invokes| RunXv6Cmd
        RunTests -->|invokes| EditMakefile
        RunTests -->|builds & runs| KernelInit
    end

    %% Networks Lab
    subgraph "Networks Lab" 
        direction TB
        subgraph "Part A: Basic Transport" 
            direction TB
            ClientTCP["client_tcp.c"]:::network
            ClientUDP["client_udp.c"]:::network
            ServerTCP["server_tcp.c"]:::network
            ServerUDP["server_udp.c"]:::network
            ClientTCP -->|TCP| NetworkCloud
            ClientUDP -->|UDP| NetworkCloud
            NetworkCloud -->|TCP| ServerTCP
            NetworkCloud -->|UDP| ServerUDP
        end
        subgraph "Part A: RPC Layer" 
            direction TB
            TCPClient["tcp_rpc_client.c"]:::network
            TCPServer["tcp_rpc_server.c"]:::network
            UDPClient["udp_rpc_client.c"]:::network
            UDPServer["udp_rpc_server.c"]:::network
            TCPClient -->|RPC over TCP| TCPServer
            UDPClient -->|RPC over UDP| UDPServer
        end
        subgraph "Part B: Reliable Transport" 
            direction TB
            RelClient["client.c"]:::network
            RelServer["server.c"]:::network
            StoredDataA["stored_data.txt"]:::artifact
            StoredDataB["stored_data.txt"]:::artifact
            RelClient -->|reliable| RelServer
            RelClient -->|logs| StoredDataA
            RelServer -->|logs| StoredDataB
        end
    end

    %% Graphs outputs
    GraphsScript -->|outputs| GraphOutput["Graphs"]:::artifact

    %% Legend for network cloud
    NetworkCloud("Network"):::network

    %% Click Events
    click GraphsScript "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/graphs/python.py"
    click SchedulerData "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/graphs/scheduler_data.txt"
    click Entry "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/initial-xv6/src/kernel/entry.S"
    click KernelInit "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/initial-xv6/src/kernel/kernelvec.S"
    click KernelInit "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/initial-xv6/src/kernel/trampoline.S"
    click Subsystems "https://github.com/miryala10sathvika/xv-6-and-networking/tree/main/initial-xv6/src/kernel/"
    click UserPrograms "https://github.com/miryala10sathvika/xv-6-and-networking/tree/main/initial-xv6/src/user/"
    click MkfsSource "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/initial-xv6/src/mkfs/mkfs.c"
    click MkfsBinary "https://github.com/miryala10sathvika/xv-6-and-networking/tree/main/initial-xv6/src/mkfs/mkfs"
    click RunTests "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/tester/run-tests.sh"
    click RunXv6Cmd "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/tester/run-xv6-command.exp"
    click EditMakefile "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/tester/xv6-edit-makefile.sh"
    click ClientTCP "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/basic/client_tcp.c"
    click ClientUDP "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/basic/client_udp.c"
    click ServerTCP "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/basic/server_tcp.c"
    click ServerUDP "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/basic/server_udp.c"
    click TCPClient "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/rpc/tcp/tcp_rpc_client.c"
    click TCPServer "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/rpc/tcp/tcp_rpc_server.c"
    click UDPClient "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/rpc/udp/udp_rpc_client.c"
    click UDPServer "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partA/rpc/udp/udp_rpc_server.c"
    click RelClient "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partB/client/client.c"
    click StoredDataA "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partB/client/stored_data.txt"
    click RelServer "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partB/server/server.c"
    click StoredDataB "https://github.com/miryala10sathvika/xv-6-and-networking/blob/main/networks/partB/server/stored_data.txt"

    %% Styles
    classDef xv6 fill:#E0F7FA,stroke:#0288D1,color:#000
    classDef network fill:#E8F5E9,stroke:#43A047,color:#000
    classDef tooling fill:#FFF9C4,stroke:#FBC02D,color:#000
    classDef artifact fill:#F3E5F5,stroke:#8E24AA,color:#000
```
