Return to Portfolio

Project Detail

CPU Scheduler Simulation

Unix-style process scheduling simulation written in C

Developed a Unix-style CPU scheduler simulation implementing process scheduling, priority recalculation, quantum management, and process state transitions.

Overview

Project Overview

This project implemented a simulated CPU scheduler capable of managing process execution in a dynamic operating system environment. The scheduler handled arrivals, blocking, termination, quantum expiration, and priority-based scheduling decisions.

Core Features

  • Round Robin scheduling within priority queues.
  • Dynamic priority recalculation.
  • Process blocking and unblocking simulation.
  • Quantum management.
  • CPU-bound and I/O-bound process handling.
  • Clock tick simulation at 60Hz.
  • Context switching logic.

Technical Concepts

  • Operating Systems
  • CPU Scheduling Algorithms
  • Process State Management
  • Queue Structures
  • Priority Scheduling
  • C Programming
  • Systems Simulation

Skills Demonstrated

  • Systems-level logic development.
  • Algorithm implementation.
  • Complex state management.
  • Structured program design.
  • Debugging and troubleshooting.
  • Performance-oriented programming.

Live Scheduler Simulation

[CLOCK TICK 1042]

PID 18 -> RUNNING -> PRI 0

PID 11 -> BLOCKED -> Waiting for I/O

PID 22 -> READY -> Queue Priority 1

Context switch triggered...

Quantum expired -> recalculating priority

Scheduling next process...

PIDCPU UsedStatePriorityQuantum UsedBlock Time
1842RUNNING046
2217READY103
1123BLOCKED-122

Implementation

Source Code

while (next_pid < 100)
{
    process_clock_tick();
    terminate_running_process();
    preempt_running_process();
    unblock_processes();
    add_new_processes();
    schedule_next_process();
}