# shreelakshmigbhat/multi-container-runtime architecture

> Architecture diagram of the GitHub repository shreelakshmigbhat/multi-container-runtime, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreelakshmigbhat/multi-container-runtime
- Repository: https://github.com/shreelakshmigbhat/multi-container-runtime

## Overview

OS JACKFRUIT is a minimal user-space container runtime paired with a Linux kernel memory-monitor module. A client invokes start/run or management commands; the supervisor receives requests over a UNIX socket, launches isolated processes in a supplied root filesystem, routes their output through a producer-consumer logger, and supports listing, reading logs, and stopping containers. For memory enforcement, the runtime registers processes and limits with the kernel module, which periodically checks usage and warns or kills. The README documents these capabilities; excerpts are partial, so internal wiring beyond the documented flow is not inferred.

Main entry points: [`boilerplate/engine.c`](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c) (Lifecycle Control), [`boilerplate/monitor.c`](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/monitor.c) (Monitor Device), [`boilerplate/cpu_hog.c`](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/cpu_hog.c) (CPU Workload), [`boilerplate/io_pulse.c`](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/io_pulse.c) (I/O Workload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Runtime Control"]
  node_client["CLI Commands<br/>[engine.c]"]
  node_socket["UNIX Socket<br/>[engine.c]"]
  node_supervisor["Supervisor<br/>[engine.c]"]
  node_lifecycle["Lifecycle Control<br/>[engine.c]"]
end

subgraph group_containers["Container Execution"]
  node_isolation["Namespace Setup<br/>[engine.c]"]
  node_rootfs["Container Rootfs"]
  node_command["Container Command"]
  node_cpu["CPU Workload<br/>[cpu_hog.c]"]
  node_io["I/O Workload<br/>[io_pulse.c]"]
  node_memory["Memory Workload<br/>[memory_hog.c]"]
end

subgraph group_logging["Output Logging"]
  node_logqueue["Bounded Log Buffer<br/>[engine.c]"]
  node_logger["Logging Thread<br/>[engine.c]"]
  node_logfiles[("Container Log Files")]
end

subgraph group_monitoring["Memory Monitoring"]
  node_registration["Monitor Registration<br/>[engine.c]"]
  node_ioctl["Monitor IOCTL API<br/>[monitor_ioctl.h]"]
  node_kernel["Kernel Monitor<br/>[monitor.c]"]
  node_device["Monitor Device<br/>[monitor.c]"]
end

node_operator(("CLI User"))
node_process["Host Process Memory"]

node_operator -->|"invokes"| node_client
node_client -->|"sends requests"| node_socket
node_socket -->|"delivers requests"| node_supervisor
node_supervisor -->|"dispatches"| node_lifecycle
node_lifecycle -->|"launches"| node_isolation
node_isolation -->|"uses rootfs"| node_rootfs
node_isolation -->|"executes"| node_command
node_command -.->|"may run"| node_cpu
node_command -.->|"may run"| node_io
node_command -.->|"may run"| node_memory
node_command -->|"writes output"| node_logqueue
node_logqueue -->|"provides chunks"| node_logger
node_logger -->|"writes logs"| node_logfiles
node_lifecycle -->|"registers process"| node_registration
node_registration -->|"issues ioctls"| node_device
node_device -->|"implements requests"| node_ioctl
node_kernel -->|"checks RSS"| node_process
node_kernel -->|"may kill"| node_process
node_device -->|"dispatches ioctls"| node_kernel

click node_client "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_socket "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_supervisor "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_lifecycle "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_isolation "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_cpu "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/cpu_hog.c"
click node_io "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/io_pulse.c"
click node_memory "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/memory_hog.c"
click node_logqueue "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_logger "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_registration "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c"
click node_ioctl "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/monitor_ioctl.h"
click node_kernel "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/monitor.c"
click node_device "https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/monitor.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_client,node_socket,node_supervisor,node_lifecycle,node_operator toneBlue
class node_isolation,node_rootfs,node_command,node_cpu,node_io,node_memory toneAmber
class node_logqueue,node_logger,node_logfiles toneMint
class node_registration,node_ioctl,node_kernel,node_device toneRose
class node_process toneIndigo
```

## Components

### Runtime Control

- [CLI Commands](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`
- [UNIX Socket](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`
- [Supervisor](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`
- [Lifecycle Control](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`

### Container Execution

- [Namespace Setup](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`
- **Container Rootfs**
- **Container Command**
- [CPU Workload](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/cpu_hog.c): `boilerplate/cpu_hog.c`
- [I/O Workload](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/io_pulse.c): `boilerplate/io_pulse.c`
- [Memory Workload](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/memory_hog.c): `boilerplate/memory_hog.c`

### Output Logging

- [Bounded Log Buffer](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`
- [Logging Thread](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`
- **Container Log Files**

### Memory Monitoring

- [Monitor Registration](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/engine.c): `boilerplate/engine.c`
- [Monitor IOCTL API](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/monitor_ioctl.h): `boilerplate/monitor_ioctl.h`
- [Kernel Monitor](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/monitor.c): `boilerplate/monitor.c`
- [Monitor Device](https://github.com/shreelakshmigbhat/multi-container-runtime/blob/main/boilerplate/monitor.c): `boilerplate/monitor.c`

### Other components

- **CLI User**
- **Host Process Memory**

## Connections

- CLI User → CLI Commands: invokes
- CLI Commands → UNIX Socket: sends requests
- UNIX Socket → Supervisor: delivers requests
- Supervisor → Lifecycle Control: dispatches
- Lifecycle Control → Namespace Setup: launches
- Namespace Setup → Container Rootfs: uses rootfs
- Namespace Setup → Container Command: executes
- Container Command → CPU Workload: may run
- Container Command → I/O Workload: may run
- Container Command → Memory Workload: may run
- Container Command → Bounded Log Buffer: writes output
- Bounded Log Buffer → Logging Thread: provides chunks
- Logging Thread → Container Log Files: writes logs
- Lifecycle Control → Monitor Registration: registers process
- Monitor Registration → Monitor Device: issues ioctls
- Monitor Device → Monitor IOCTL API: implements requests
- Kernel Monitor → Host Process Memory: checks RSS
- Kernel Monitor → Host Process Memory: may kill
- Monitor Device → Kernel Monitor: dispatches ioctls
