How kamardine1/hoare_prime works
This C program answers prime-number queries through a persistent master and a dynamically extended Hoare-sieve worker pipeline. Clients send commands over named pipes; the master serializes clients with semaphores, dispatches compute requests to workers, tracks successful primes, and returns results. The README also documents a local-compute client command, though the sampled client code does not show its implementation. Edges reflect the sampled calls and README-described workflow; the worker-to-worker executable launch is visible in source.
Main entry points: master.c Request master · client.c Command client · worker.c Sieve worker · master_client.c Client locks
Components 14
Client interface
- Command client
src/client.c - Local compute option
src/client.c
Master coordination
- Request master
src/master.c - Prime statistics
src/master.c - First worker setup
src/master_worker.c
Worker sieve
- Sieve worker
src/worker.c
IPC support
- Client locks
src/master_client.c - Named pipe helpers
src/master_client.c - Client IPC contract
include/master_client.h - Worker IPC contract
include/master_worker.h
Other components
- Client user
- Client master FIFOs
- Master worker pipes
- Worker chain pipes
Connections 24
- Client user → Command client: invokes
README.md - Command client → Request master: sends command
README.md - Command client → Client locks: locks client
src/client.c - Command client → Named pipe helpers: opens pipes
src/client.c - Command client → Client master FIFOs: writes request
src/client.c - Request master → Client master FIFOs: reads request
src/master.c - Request master → Client master FIFOs: writes response
src/master.c - Request master → Client locks: waits for client
src/master.c - Command client → Client locks: releases master
src/client.c - Request master → First worker setup: starts worker
src/master.c - First worker setup → Sieve worker: executes
src/master_worker.c - Request master → Master worker pipes: dispatches number
src/master.c - Sieve worker → Master worker pipes: reads number
src/worker.c - Sieve worker → Master worker pipes: returns result
src/worker.c - Request master → Prime statistics: updates counts
src/master.c - Request master → Master worker pipes: sends stop
src/master.c - Sieve worker → Worker chain pipes: forwards number
src/worker.c - Sieve worker → Sieve worker: spawns next
src/worker.c - Command client → Local compute option: selects option
src/client.c - Command client → Client IPC contract: uses constants
src/client.c - Request master → Client IPC contract: uses protocol
src/master.c - Request master → Worker IPC contract: uses protocol
src/master.c - Sieve worker → Worker IPC contract: uses stop order
src/worker.c - Request master → Named pipe helpers: creates FIFOs
src/master.c