Projects · University
Emergency Department simulation
A hospital emergency department where every role is a separate process, coordinating purely through POSIX message queues, shared memory, semaphores and signals.

1 photo
My final project for the operating systems course, which got full marks. The master process spawns and reaps registration windows, triage, doctors, a dispatcher and one process per patient (children are threads of their guardian's process), and all of them talk only through IPC.
- Queues that sort themselves. Message-queue priorities encode VIP status and triage colour, so patients are ordered by the kernel, not by application code.
- A single writer for the per-patient control registry in shared memory (the dispatcher), which keeps the concurrency story simple and checkable. Each patient has a slot, found by hashing its pid, holding a single-producer, single-consumer ring with its own process-shared semaphore, which is how a message reaches one specific process.
- A second registration window opens when the registration queue grows past its threshold and closes again when it shrinks.
- An interactive console while the simulation runs: add patients in bursts or on a timer, add or send home doctors, send the director's signals, or evacuate the building with
SIGUSR2. - Clean shutdown on Ctrl-C, a
clean-ipctarget for runs killed withSIGKILL, and tools to dump the shared state of a running simulation or send a control message by hand.

