# waelm0/realtimeproject1 architecture

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

- Interactive diagram: https://gitdiagram.com/waelm0/realtimeproject1
- Repository: https://github.com/waelm0/realtimeproject1

## Overview

RealTimeProject1 simulates a two-team furniture-passing competition: a coordinator loads settings and starts worker chains, pieces move toward sinks for ordered placement, and rejected pieces return along reverse chains. Wins update a shared scoreboard and trigger round-reset barriers; a separate GLUT process visualizes worker and piece activity. The graph preserves documented serial-selection, signal, IPC, and display capabilities. Some implementation details are unsampled, so those relationships are shown only where the README or excerpts support them.

Main entry points: [`src/main.c`](https://github.com/waelm0/realtimeproject1/blob/main/src/main.c) (Coordinator), [`src/team.c`](https://github.com/waelm0/realtimeproject1/blob/main/src/team.c) (Sink Placement), [`src/ipc.c`](https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c) (Forward and Return Pipes), [`src/signals.c`](https://github.com/waelm0/realtimeproject1/blob/main/src/signals.c) (Signal Control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_coord["Coordination"]
  node_coordinator["Coordinator<br/>[main.c]"]
  node_signal_control["Signal Control<br/>[signals.c]"]
  node_round_barrier["Round Barrier<br/>[ipc.c]"]
end

subgraph group_game["Competition"]
  node_source["Team Sources<br/>[team.c]"]
  node_middle["Member Hops<br/>[team.c]"]
  node_sink["Sink Placement<br/>[team.c]"]
  node_serials["Serial Selection<br/>[team.c]"]
end

subgraph group_ipc["IPC and State"]
  node_pipe_chains["Forward and Return Pipes<br/>[ipc.c]"]
  node_display_fifo["Display FIFO<br/>[ipc.c]"]
  node_scoreboard[("Shared Scoreboard<br/>[ipc.c]")]
  node_win_pipe["Win Notifications<br/>[signals.c]"]
end

subgraph group_ui["Visualization"]
  node_display_process["Display Process<br/>[main.c]"]
  node_glut_view["GLUT Viewer<br/>[display.c]"]
end

subgraph group_support["Configuration and Support"]
  node_config["Config Loader<br/>[config.c]"]
  node_logging["Logging<br/>[log.c]"]
end

node_operator(("Run Configuration"))

node_operator -->|"starts with config"| node_coordinator
node_coordinator -->|"loads settings"| node_config
node_coordinator -->|"starts workers"| node_source
node_source -->|"selects pieces"| node_serials
node_source -->|"sends pieces"| node_pipe_chains
node_pipe_chains -->|"carries handoffs"| node_middle
node_middle -->|"forwards or returns"| node_pipe_chains
node_pipe_chains -->|"delivers pieces"| node_sink
node_sink -->|"checks order"| node_scoreboard
node_sink -->|"returns rejects"| node_pipe_chains
node_sink -->|"notifies wins"| node_win_pipe
node_win_pipe -->|"reports win"| node_coordinator
node_coordinator -->|"updates scores"| node_scoreboard
node_coordinator -->|"resets rounds"| node_round_barrier
node_round_barrier -->|"signals workers"| node_signal_control
node_signal_control -->|"resets or stops"| node_source
node_signal_control -->|"resets or stops"| node_middle
node_signal_control -->|"resets or stops"| node_sink
node_coordinator -->|"execs viewer"| node_display_process
node_source -->|"writes events"| node_display_fifo
node_middle -->|"writes events"| node_display_fifo
node_sink -->|"writes events"| node_display_fifo
node_display_fifo -->|"feeds events"| node_glut_view
node_scoreboard -->|"provides scores"| node_glut_view

click node_coordinator "https://github.com/waelm0/realtimeproject1/blob/main/src/main.c"
click node_signal_control "https://github.com/waelm0/realtimeproject1/blob/main/src/signals.c"
click node_config "https://github.com/waelm0/realtimeproject1/blob/main/src/config.c"
click node_source "https://github.com/waelm0/realtimeproject1/blob/main/src/team.c"
click node_middle "https://github.com/waelm0/realtimeproject1/blob/main/src/team.c"
click node_sink "https://github.com/waelm0/realtimeproject1/blob/main/src/team.c"
click node_serials "https://github.com/waelm0/realtimeproject1/blob/main/src/team.c"
click node_pipe_chains "https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c"
click node_display_fifo "https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c"
click node_scoreboard "https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c"
click node_win_pipe "https://github.com/waelm0/realtimeproject1/blob/main/src/signals.c"
click node_round_barrier "https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c"
click node_display_process "https://github.com/waelm0/realtimeproject1/blob/main/src/main.c"
click node_glut_view "https://github.com/waelm0/realtimeproject1/blob/main/src/display.c"
click node_logging "https://github.com/waelm0/realtimeproject1/blob/main/src/log.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_coordinator,node_signal_control,node_round_barrier toneBlue
class node_source,node_middle,node_sink,node_serials toneAmber
class node_pipe_chains,node_display_fifo,node_scoreboard,node_win_pipe toneMint
class node_display_process,node_glut_view toneRose
class node_config,node_logging,node_operator toneIndigo
```

## Components

### Coordination

- [Coordinator](https://github.com/waelm0/realtimeproject1/blob/main/src/main.c): `src/main.c`
- [Signal Control](https://github.com/waelm0/realtimeproject1/blob/main/src/signals.c): `src/signals.c`
- [Round Barrier](https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c): `src/ipc.c`

### Competition

- [Team Sources](https://github.com/waelm0/realtimeproject1/blob/main/src/team.c): `src/team.c`
- [Member Hops](https://github.com/waelm0/realtimeproject1/blob/main/src/team.c): `src/team.c`
- [Sink Placement](https://github.com/waelm0/realtimeproject1/blob/main/src/team.c): `src/team.c`
- [Serial Selection](https://github.com/waelm0/realtimeproject1/blob/main/src/team.c): `src/team.c`

### IPC and State

- [Forward and Return Pipes](https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c): `src/ipc.c`
- [Display FIFO](https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c): `src/ipc.c`
- [Shared Scoreboard](https://github.com/waelm0/realtimeproject1/blob/main/src/ipc.c): `src/ipc.c`
- [Win Notifications](https://github.com/waelm0/realtimeproject1/blob/main/src/signals.c): `src/signals.c`

### Visualization

- [Display Process](https://github.com/waelm0/realtimeproject1/blob/main/src/main.c): `src/main.c`
- [GLUT Viewer](https://github.com/waelm0/realtimeproject1/blob/main/src/display.c): `src/display.c`

### Configuration and Support

- [Config Loader](https://github.com/waelm0/realtimeproject1/blob/main/src/config.c): `src/config.c`
- [Logging](https://github.com/waelm0/realtimeproject1/blob/main/src/log.c): `src/log.c`

### Other components

- **Run Configuration**

## Connections

- Run Configuration → Coordinator: starts with config (evidence: `README.md`)
- Coordinator → Config Loader: loads settings (evidence: `src/main.c`)
- Coordinator → Team Sources: starts workers (evidence: `README.md`)
- Team Sources → Serial Selection: selects pieces (evidence: `README.md`)
- Team Sources → Forward and Return Pipes: sends pieces (evidence: `README.md`)
- Forward and Return Pipes → Member Hops: carries handoffs (evidence: `README.md`)
- Member Hops → Forward and Return Pipes: forwards or returns (evidence: `README.md`)
- Forward and Return Pipes → Sink Placement: delivers pieces (evidence: `README.md`)
- Sink Placement → Shared Scoreboard: checks order (evidence: `README.md`)
- Sink Placement → Forward and Return Pipes: returns rejects (evidence: `README.md`)
- Sink Placement → Win Notifications: notifies wins (evidence: `README.md`)
- Win Notifications → Coordinator: reports win (evidence: `src/main.c`)
- Coordinator → Shared Scoreboard: updates scores (evidence: `src/main.c`)
- Coordinator → Round Barrier: resets rounds (evidence: `src/main.c`)
- Round Barrier → Signal Control: signals workers
- Signal Control → Team Sources: resets or stops (evidence: `README.md`)
- Signal Control → Member Hops: resets or stops (evidence: `README.md`)
- Signal Control → Sink Placement: resets or stops (evidence: `README.md`)
- Coordinator → Display Process: execs viewer (evidence: `src/main.c`)
- Team Sources → Display FIFO: writes events (evidence: `README.md`)
- Member Hops → Display FIFO: writes events (evidence: `README.md`)
- Sink Placement → Display FIFO: writes events (evidence: `README.md`)
- Display FIFO → GLUT Viewer: feeds events (evidence: `README.md`)
- Shared Scoreboard → GLUT Viewer: provides scores (evidence: `README.md`)
