← Back to list

Hospital Patient Triage & Bed Allocator (Linux-based OS Project)

I have completed my Operating Systems semester project titled Hospital Patient Triage & Bed Allocator, implemented in C using Linux system…

Minahilriaz · 2026-05-08 17:12 · 1 claps · 2.0 min read
#operating-systems #posix #threads #semaphore #linux
Open on Medium ↗
Wiki topics: 🔓 · Open Source

Hospital Patient Triage & Bed Allocator (Linux-based OS Project)

I have completed my Operating Systems semester project titled Hospital Patient Triage & Bed Allocator, implemented in C using Linux system programming concepts.

Introduction

The goal of this project was to simulate real-world hospital operations while applying core Operating Systems concepts in a practical environment. The system models how patients are admitted, prioritized, allocated beds, treated, and discharged, similar to how an OS manages processes and system resources.

In this simulation:

  • Patients represent processes
  • Hospital beds represent memory blocks
  • Admission requests represent memory allocation requests
  • Discharge represents memory deallocation

This analogy helped in understanding how operating systems handle resource management under constraints.

Core Concepts Implemented

1. Process Management

The system uses fork() and exec() to simulate patient admissions as independent processes.

2. Multithreading

POSIX threads (pthreads) are used to handle concurrent operations such as admission, scheduling, and treatment.

3. Synchronization

To avoid race conditions, the following synchronization techniques were implemented:

  • Mutexes
  • Semaphores
  • Condition variables

These ensured safe access to shared resources.

4. Inter-Process Communication (IPC)

Communication between processes was achieved using:

  • Shared memory
  • FIFO (named pipes)

This allowed efficient data sharing between system components.

5. CPU Scheduling Simulation

The system supports:

  • FCFS (First Come First Serve)
  • Priority Scheduling

Patients are handled based on urgency and arrival time.

6. Memory Management Simulation

Different allocation strategies were implemented:

  • First Fit
  • Best Fit
  • Worst Fit

The system also simulates:

  • External fragmentation
  • Coalescing of free memory blocks
  • Paging concepts (basic simulation)

Key Learning Outcomes

This project provided practical exposure to:

  • Process synchronization in concurrent systems
  • Real-world scheduling algorithms
  • Memory allocation and fragmentation handling
  • Inter-process communication techniques
  • Debugging multi-threaded applications in Linux

One of the most interesting observations was how external fragmentation gradually appears over time, similar to real operating systems when memory is continuously allocated and freed.

Tech Stack

  • C Programming Language
  • Linux System Programming
  • POSIX Threads (pthreads)
  • IPC (Shared Memory & FIFO)
  • GCC Compiler

Conclusion

This project helped bridge the gap between theoretical OS concepts and their real-world implementation. It improved my understanding of system-level programming, especially in areas like concurrency, memory management, and scheduling.

Overall, it was a valuable hands-on experience in understanding how operating systems manage complex resource allocation scenarios.


메타데이터
post_id
0fda05571bf7
slug
hospital-patient-triage-bed-allocator-linux-based-os-project-0fda05571bf7
url
https://medium.com/@minahilriaz1881/hospital-patient-triage-bed-allocator-linux-based-os-project-0fda05571bf7
canonical_url
https://medium.com/@minahilriaz1881/hospital-patient-triage-bed-allocator-linux-based-os-project-0fda05571bf7
author_url
https://medium.com/@minahilriaz1881
status
ok
fetched_at
2026-06-28 10:39:35