This project is a multi-process simulation of a hospital organ transplant system, implemented in C using UNIX System V IPC mechanisms.
The goal is to model how critical and non-critical patients, surgeons, and donors coordinate in a concurrent environment while respecting synchronization constraints.
This project was developed as part of an Operating Systems / Concurrency course.
The system consists of four main processes:
- Send organ requests with high priority
- Receive organs via message queue
- Must be served before non-critical patients
- Send organ requests with lower priority
- Wait for availability after critical patients
- Receives patient requests from message queues
- Transfers requests to donors via a pipe
- Retrieves fabricated organs from shared memory
- Sends results back to patients
- Produces organs based on received requests
- Deposits organs into a shared buffer (fridge)
- Respects buffer capacity using semaphores
| Mechanism | Purpose |
|---|---|
| Message Queues | Communication between patients and surgeon |
| Shared Memory | Shared organ buffer (fridge) |
| Semaphores | Synchronization (mutex + empty slots) |
| Pipes | Surgeon → Donor communication |
| Fork | Process creation |
- Producer–Consumer problem
- Shared circular buffer
- Semaphores:
nvide→ number of empty slotsmutex→ mutual exclusion
- Priority handling for critical patients
StructureDemande→ organ requestStructureReponse→ transplant resultElementTampon→ organ unitMemoirePartagee→ circular shared buffer
gcc -Wall -o hospital hospital.c