Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🖥️ NachOS Task Scheduling Simulator

A two-layer CPU scheduling simulator built as part of OS coursework at Amrita Vishwa Vidyapeetham. Implements four classic scheduling algorithms in C++, with a live animated GUI frontend in Python.


📌 Project Structure

taskscheduler/
├── task_scheduler.cc   # Core scheduling engine in C++ (terminal output)
└── simulator.py        # Live animated GUI built on top of the C++ logic

The two files represent two layers of the same project:

  • task_scheduler.cc — the brain: raw C++ implementation of all four algorithms, runs in terminal, prints Gantt chart as text output
  • simulator.py — the face: Python GUI that faithfully mirrors the C++ logic with real-time animation, color-coded Gantt charts, and live metrics

The Python algorithms are written to match the exact behaviour of the C++ backend — same sorting, same tie-breaking, same dependency resolution order.


⚙️ Algorithms Implemented

Algorithm Description
FCFS First Come First Served — sorted by arrival time, first eligible task runs
SJF Shortest Job First — picks the task with minimum burst time among eligible
Round Robin Time-sliced with configurable quantum, re-enqueues preempted tasks
Priority Picks task with lowest priority number among eligible

All four algorithms support:

  • DAG dependencies — a task can declare depends_on: [T1, T2] and will be blocked until those finish
  • Deadlines — each task has a deadline; missed tasks are flagged in the results
  • Slack time — computed as deadline - finish_time

🚀 Running the GUI Simulator

Requirements: Python 3.x (tkinter is included in standard library)

python simulator.py

How to use:

  1. Enter tasks — name, submit time, duration, priority, deadline, and optional dependencies (e.g. T1,T2)
  2. Select an algorithm and optionally set quantum (for Round Robin)
  3. Adjust animation speed with the slider
  4. Hit RUN — watch the Gantt chart animate live

🖥️ Running the C++ Scheduler

g++ -o scheduler task_scheduler.cc
./scheduler

Outputs a text-based Gantt chart and per-task metrics (waiting time, completion time, slack) to the terminal.


✨ Features

  • Live Gantt chart — color-coded blocks scroll in real time as the scheduler runs
  • Deadline markers — red dashed lines show each task's deadline on the Gantt
  • Per-task progress bars — show WAITING / BLOCKED / PAUSED / DONE states
  • BLOCKED state — tasks waiting for dependencies are highlighted in purple
  • Results table — updates as tasks complete; missed deadlines highlighted in red
  • Live stats — avg waiting time, avg completion time, makespan, deadline hit rate, avg slack
  • Pause / Resume / Stop controls
  • Adjustable speed — from 0.2x to 5x

📚 Concepts Covered

This project directly maps to core OS topics:

  • CPU scheduling algorithms (GATE CSE syllabus)
  • DAG-based task dependency graphs
  • Preemption and context switching (Round Robin)
  • Deadline scheduling and slack time
  • NachOS thread scheduling internals

🛠️ Tech Stack

  • C++ — core algorithm implementation
  • Python 3 — GUI and animation
  • Tkinter — UI framework (standard library, no installs needed)
  • Threading — animation runs on a separate thread to keep UI responsive

📷 Screenshot

image

👩‍💻 Author

Anwi — BTech CSE, Amrita Vishwa Vidyapeetham, Bengaluru
GitHub: @Anwiii

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages