Skip to content

Operating System algorithms in C including CPU scheduling, page replacement, and disk scheduling with simple and advanced implementations.

License

Notifications You must be signed in to change notification settings

TheHarmanCodes/operating-system-algorithms-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Operating System algorithms in C including CPU scheduling, page replacement, and disk scheduling with simple and advanced implementations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages