Skip to content

Interactive CPU scheduling simulator implementing core OS algorithms (FCFS, SJF, Round Robin) with real-time Gantt chart visualization and scheduling metrics.

Notifications You must be signed in to change notification settings

AnkeshGG/MiniOS_Scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚙️ MiniOS Scheduler – CPU Scheduling Simulator

A console-based Mini Operating System Simulator written in C (C99) that demonstrates core CPU scheduling algorithms. This project computes essential scheduling metrics and visualizes execution using text-based Gantt charts, making it ideal for academic learning, OS labs, and portfolio showcases.

C License: MIT Platform


🧠 Why MiniOS Scheduler?

Understanding CPU scheduling is fundamental to Operating Systems, but theory alone isn't enough. MiniOS Scheduler bridges that gap by allowing users to interactively simulate scheduling algorithms, observe execution order, and analyze performance metrics in real time.


🚀 Key Features

🗂️ Supported Scheduling Algorithms

  • First Come First Serve (FCFS)
  • Shortest Job First (SJF – Non-Preemptive)
  • Round Robin (RR) with configurable time quantum

⌨️ Interactive Input

  • User-defined Process ID
  • Arrival Time
  • Burst Time
  • Time Quantum (for Round Robin)

📊 Computed Metrics

  • Completion Time (CT)
  • Turnaround Time (TAT)
  • Waiting Time (WT)
  • Average Waiting Time
  • Average Turnaround Time

📈 Execution Visualization

  • Text-based Gantt Chart for each scheduling run
  • Clearly shows CPU allocation over time

🧩 Modular Design

  • Clean separation of scheduling logic
  • Reusable utilities for sorting, printing, and statistics
  • Easy to extend with new algorithms

🛠️ Technical Specifications

  • Language Standard: C99 (-std=c99)
  • Libraries Used: Standard C libraries only (stdio.h, stdlib.h, string.h)
  • Maximum Processes: Configurable (MAX_PROCESSES = 100 by default)
  • Time Units: Integer-based simulation
  • Round Robin: Time quantum must be a positive integer

Error Handling

  • Invalid menu choices
  • Negative arrival times
  • Zero or negative burst times

🧱 Data Structures

Process Structure

  • pid – Process ID
  • arrival_time – Arrival time
  • burst_time – Original CPU burst
  • remaining_time – Used by Round Robin
  • start_time – First execution time
  • completion_time – Finish time
  • turnaround_time – CT − AT
  • waiting_time – TAT − BT
  • finished – Boolean flag

GanttEntry Structure

  • pid – Process ID
  • start – Start time
  • end – End time

Used to render the Gantt chart.


🗂️ Project Structure

MiniOS_Scheduler/
├── main.c                // Menu-driven program and input handling
├── scheduler.h           // Shared structs and function declarations
├── fcfs.c                // FCFS scheduling implementation
├── sjf.c                 // SJF (non-preemptive) implementation
├── round_robin.c         // Round Robin scheduling with queue logic
├── utils.c               // Utilities: sorting, tables, Gantt, averages
├── utils.h               // Utility function declarations
└── README.md             // Project documentation

⚡ Build and Run Instructions

Compile

gcc -std=c99 -Wall -Wextra main.c fcfs.c sjf.c round_robin.c utils.c -o MiniOS_Scheduler

Run

./MiniOS_Scheduler

Follow the interactive menu to:

  1. Enter process details
  2. Choose a scheduling algorithm
  3. View computed metrics and Gantt chart

📥 Sample Usage Summary

  1. Enter 3 processes with different arrival and burst times
  2. Run FCFS to view:
    • Process table
    • Waiting & turnaround times
    • Gantt chart
  3. Run Round Robin with a small time quantum to:
    • Observe time-sliced execution
    • Compare metrics with FCFS and SJF

🧪 Testing & Validation

Manual Test Cases

  • Small process sets with known expected averages

Edge Cases Covered

  • CPU idle periods
  • Same arrival times
  • Same burst times
  • Very large vs very small time quantum

💡 Future Enhancements

  • Preemptive SJF (SRTF)
  • Priority Scheduling
  • File-based input/output
  • Colored Gantt charts
  • Performance comparison summary across algorithms

📄 License

This project is released under the MIT License.
Feel free to use, modify, and distribute with attribution.


👨‍💻 About the Author

Ankesh KumarComputer Science Student | Systems & Java Enthusiast

Built to strengthen OS fundamentals and demonstrate clean, modular C programming suitable for academic and resume use.

Connect With Me


🙏 Acknowledgements

  • Operating Systems Concepts – For theoretical foundation
  • C Programming Community – For best practices and guidance
  • Open Source Contributors – Who make learning accessible

📊 Project Status

🟢 Actively maintained

  • Version: 1.0.0
  • Last Updated: January 2026
  • Stars: ⭐ Give this project a star if you found it helpful!

⭐ If this project helped you understand CPU scheduling better, consider starring it!


© 2026 Ankesh Kumar.

Learning by building – one algorithm at a time.

Built with dedication

About

Interactive CPU scheduling simulator implementing core OS algorithms (FCFS, SJF, Round Robin) with real-time Gantt chart visualization and scheduling metrics.

Topics

Resources

Stars

Watchers

Forks

Languages