# kamillemelgaard04-design/a1 architecture

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

- Interactive diagram: https://gitdiagram.com/kamillemelgaard04-design/a1
- Repository: https://github.com/kamillemelgaard04-design/a1

## Overview

This repository contains small C command-line programs for searching files, counting set bits, and computing Fibonacci numbers; it is not a single integrated application. The principal file-oriented workflow walks supplied paths and processes regular files, while the Fibonacci program reads lines from standard input. Multithreaded variants are present, but the grep and histogram variants contain assertion placeholders rather than implemented worker workflows. The README gives no further capability details, so relationships below follow the shown source; the job-queue implementation is also stubbed.

Main entry points: [`fibs.c`](https://github.com/kamillemelgaard04-design/a1/blob/main/fibs.c) (Line reader), [`fhistogram.c`](https://github.com/kamillemelgaard04-design/a1/blob/main/fhistogram.c) (File histogram), [`fauxgrep.c`](https://github.com/kamillemelgaard04-design/a1/blob/main/fauxgrep.c) (File search), [`job_queue.h`](https://github.com/kamillemelgaard04-design/a1/blob/main/job_queue.h) (Job queue API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_file_tools["File tools"]
  node_file_search["File search<br/>[fauxgrep.c]"]
  node_line_matcher["Line matcher<br/>[fauxgrep.c]"]
  node_parallel_search["Parallel search<br/>[fauxgrep-mt.c]"]
  node_file_histogram["File histogram<br/>[fhistogram.c]"]
  node_parallel_histogram["Parallel histogram<br/>[fhistogram-mt.c]"]
end

subgraph group_fib_tool["Fibonacci tool"]
  node_line_reader["Line reader<br/>[fibs.c]"]
  node_fibonacci["Fibonacci calculator<br/>[fibs.c]"]
end

subgraph group_concurrency["Concurrency"]
  node_worker_pool["Worker pool<br/>[fibs.c]"]
  node_job_queue_api["Job queue API<br/>[job_queue.h]"]
  node_job_queue_impl["Job queue implementation<br/>[job_queue.c]"]
end

subgraph group_shared_logic["Shared logic"]
  node_bit_counter["Bit counter<br/>[histogram.h]"]
  node_histogram_display["Histogram display<br/>[histogram.h]"]
end

node_user(("CLI user"))
node_filesystem[("Files and paths")]
node_terminal(("Standard input/output"))

node_user -->|"invokes"| node_file_search
node_file_search -->|"walks paths"| node_filesystem
node_file_search -->|"processes files"| node_line_matcher
node_line_matcher -->|"reads lines"| node_filesystem
node_line_matcher -->|"prints matches"| node_terminal
node_user -->|"invokes"| node_parallel_search
node_parallel_search -->|"walks paths"| node_filesystem
node_user -->|"invokes"| node_file_histogram
node_file_histogram -->|"walks and reads"| node_filesystem
node_file_histogram -->|"updates counts"| node_bit_counter
node_file_histogram -->|"prints counts"| node_histogram_display
node_bit_counter -->|"provides counts"| node_histogram_display
node_user -->|"invokes"| node_parallel_histogram
node_parallel_histogram -->|"walks paths"| node_filesystem
node_user -->|"invokes"| node_line_reader
node_line_reader -->|"reads lines"| node_terminal
node_line_reader -->|"enqueues lines"| node_job_queue_api
node_line_reader -->|"starts workers"| node_worker_pool
node_worker_pool -->|"dequeues lines"| node_job_queue_api
node_worker_pool -->|"processes lines"| node_fibonacci
node_fibonacci -->|"prints results"| node_terminal
node_line_reader -.->|"uses queue"| node_job_queue_impl
node_job_queue_api -->|"declares operations"| node_job_queue_impl

click node_file_search "https://github.com/kamillemelgaard04-design/a1/blob/main/fauxgrep.c"
click node_line_matcher "https://github.com/kamillemelgaard04-design/a1/blob/main/fauxgrep.c"
click node_parallel_search "https://github.com/kamillemelgaard04-design/a1/blob/main/fauxgrep-mt.c"
click node_file_histogram "https://github.com/kamillemelgaard04-design/a1/blob/main/fhistogram.c"
click node_parallel_histogram "https://github.com/kamillemelgaard04-design/a1/blob/main/fhistogram-mt.c"
click node_bit_counter "https://github.com/kamillemelgaard04-design/a1/blob/main/histogram.h"
click node_histogram_display "https://github.com/kamillemelgaard04-design/a1/blob/main/histogram.h"
click node_line_reader "https://github.com/kamillemelgaard04-design/a1/blob/main/fibs.c"
click node_fibonacci "https://github.com/kamillemelgaard04-design/a1/blob/main/fibs.c"
click node_worker_pool "https://github.com/kamillemelgaard04-design/a1/blob/main/fibs.c"
click node_job_queue_api "https://github.com/kamillemelgaard04-design/a1/blob/main/job_queue.h"
click node_job_queue_impl "https://github.com/kamillemelgaard04-design/a1/blob/main/job_queue.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_file_search,node_line_matcher,node_parallel_search,node_file_histogram,node_parallel_histogram,node_user toneBlue
class node_line_reader,node_fibonacci,node_filesystem toneAmber
class node_worker_pool,node_job_queue_api,node_job_queue_impl toneMint
class node_bit_counter,node_histogram_display toneRose
class node_terminal toneIndigo
```

## Components

### File tools

- [File search](https://github.com/kamillemelgaard04-design/a1/blob/main/fauxgrep.c): `fauxgrep.c`
- [Line matcher](https://github.com/kamillemelgaard04-design/a1/blob/main/fauxgrep.c): `fauxgrep.c`
- [Parallel search](https://github.com/kamillemelgaard04-design/a1/blob/main/fauxgrep-mt.c): `fauxgrep-mt.c`
- [File histogram](https://github.com/kamillemelgaard04-design/a1/blob/main/fhistogram.c): `fhistogram.c`
- [Parallel histogram](https://github.com/kamillemelgaard04-design/a1/blob/main/fhistogram-mt.c): `fhistogram-mt.c`

### Fibonacci tool

- [Line reader](https://github.com/kamillemelgaard04-design/a1/blob/main/fibs.c): `fibs.c`
- [Fibonacci calculator](https://github.com/kamillemelgaard04-design/a1/blob/main/fibs.c): `fibs.c`

### Concurrency

- [Worker pool](https://github.com/kamillemelgaard04-design/a1/blob/main/fibs.c): `fibs.c`
- [Job queue API](https://github.com/kamillemelgaard04-design/a1/blob/main/job_queue.h): `job_queue.h`
- [Job queue implementation](https://github.com/kamillemelgaard04-design/a1/blob/main/job_queue.c): `job_queue.c`

### Shared logic

- [Bit counter](https://github.com/kamillemelgaard04-design/a1/blob/main/histogram.h): `histogram.h`
- [Histogram display](https://github.com/kamillemelgaard04-design/a1/blob/main/histogram.h): `histogram.h`

### Other components

- **CLI user**
- **Files and paths**
- **Standard input/output**

## Connections

- CLI user → File search: invokes (evidence: `fauxgrep.c`)
- File search → Files and paths: walks paths (evidence: `fauxgrep.c`)
- File search → Line matcher: processes files (evidence: `fauxgrep.c`)
- Line matcher → Files and paths: reads lines (evidence: `fauxgrep.c`)
- Line matcher → Standard input/output: prints matches (evidence: `fauxgrep.c`)
- CLI user → Parallel search: invokes (evidence: `fauxgrep-mt.c`)
- Parallel search → Files and paths: walks paths (evidence: `fauxgrep-mt.c`)
- CLI user → File histogram: invokes (evidence: `fhistogram.c`)
- File histogram → Files and paths: walks and reads (evidence: `fhistogram.c`)
- File histogram → Bit counter: updates counts (evidence: `fhistogram.c`)
- File histogram → Histogram display: prints counts (evidence: `fhistogram.c`)
- Bit counter → Histogram display: provides counts (evidence: `histogram.h`)
- CLI user → Parallel histogram: invokes (evidence: `fhistogram-mt.c`)
- Parallel histogram → Files and paths: walks paths (evidence: `fhistogram-mt.c`)
- CLI user → Line reader: invokes (evidence: `fibs.c`)
- Line reader → Standard input/output: reads lines (evidence: `fibs.c`)
- Line reader → Job queue API: enqueues lines (evidence: `fibs.c`)
- Line reader → Worker pool: starts workers (evidence: `fibs.c`)
- Worker pool → Job queue API: dequeues lines (evidence: `fibs.c`)
- Worker pool → Fibonacci calculator: processes lines (evidence: `fibs.c`)
- Fibonacci calculator → Standard input/output: prints results (evidence: `fibs.c`)
- Line reader → Job queue implementation: uses queue
- Job queue API → Job queue implementation: declares operations (evidence: `job_queue.c`)
