Skip to content

Latest commit

 

History

History
90 lines (61 loc) · 2.17 KB

File metadata and controls

90 lines (61 loc) · 2.17 KB

Operating System Algorithms in C

This repository contains important Operating System algorithms implemented in C, covering topics that are commonly taught in UG, PG Computer Science and IT courses.

The main focus of this project is to provide clear, easy-to-understand implementations of OS algorithms such as CPU scheduling, page replacement, and disk scheduling, without unnecessary complexity.
Each program is written to understand how the algorithm works internally, step by step.


📂 Repository Structure

operating-system-algorithms-c/
|
|─── CPU-Scheduling/
| ├── fcfs_cpu_scheduling.c
| ├── sjf_cpu_scheduling.c
|
|─── Disk-Scheduling/
| ├── fcfs_disk_scheduling.c
| ├── fcfs_disk_scheduling_head_movement.c
| ├── sstf_disk_scheduling.c
| ├── sstf_disk_scheduling_head_movement.c
| |─── Disk-Scheduling/
| ├── fifo_page_replacement.c
| ├── lru_page_replacement.c
|
└── README.md


⚙️ Algorithms Covered

⭐ CPU Scheduling Algorithms

  • FCFS (First Come First Serve)
  • SJF (Shortest Job First)

These programs calculate scheduling order and basic timing parameters based on process burst times.


⭐ Page Replacement Algorithms

  • FIFO (First In First Out)
  • LRU (Least Recently Used)

These programs simulate memory frames and calculate page faults.


⭐ Disk Scheduling Algorithms

  • FCFS Disk Scheduling
  • SCAN Disk Scheduling (Simple Version)
    • Calculates total seek time only
  • SCAN Disk Scheduling (Advanced Version)
    • Calculates:
      • Total seek time
      • Read/write head movement
      • Direction changes count

The advanced version provides a more realistic simulation of disk head movement.


🛠 Language & Tools

  • Language: C
  • Compiler: GCC
  • Platform: Any (Linux / Windows / macOS)

⚙️ How to Compile & Run

Navigate to the algorithm folder and use:

gcc filename.c -o output
./output

👨‍💻 Author

Harman Singh

📄 License

This project is licensed under the MIT License — free to use, modify, and share with attribution.