🎓 Mini lab project for CSE324: Operating System Lab, Daffodil International University · Team of 5
A terminal-based Distributed Task Scheduler built in Python, simulating how an operating system schedules tasks based on priority, CPU, RAM, storage, and execution time — including real-time preemption (higher-priority tasks can pause lower-priority ones).
- 🖥️ Simple command-line interface (CLI) — add tasks and watch them run live
- 📊 Live dashboard showing:
- Total vs. available CPU, RAM, and storage
- Currently running tasks (active/paused)
- Tasks waiting in the ready queue
- ⏫ Priority-based preemptive scheduling — a higher-priority task can pause a running lower-priority task
- 🧠 Resource-aware scheduling — a task only runs if there's enough CPU, RAM, and storage available; otherwise it waits in the ready queue
- 🔁 A background thread ("tick") continuously counts down task time and automatically starts queued tasks when resources free up
- 🎨 Colorful, easy-to-read terminal output
- Python 3
threading— for running the scheduler and the countdown timer at the same timeheapq(priority queue) — to keep the ready queue sorted by priority- Core OS concepts: preemptive priority scheduling, resource allocation, and concurrency
- Python 3.6 or newer
No external libraries are needed — everything used (threading, os, heapq, time) comes built into Python.
Check your Python version:
python3 --version-
Clone this repository:
git clone https://github.com/inglorious-star/Distributed-Task-Scheduler-OS-Project.git cd Distributed-Task-Scheduler-OS-Project -
Run the program:
python3 dts30.py
-
You'll see a dashboard and a
>prompt where you can type commands.
| Command | What it does |
|---|---|
add <id> <priority> <cpu> <ram> <space> <duration> |
Adds a new task to the scheduler |
refresh |
Redraws the dashboard (useful to see updated countdowns) |
quit |
Stops the scheduler and exits |
add <id> <priority> <cpu> <ram> <space> <duration>
| Field | Meaning |
|---|---|
id |
A name/label for the task (e.g., T1) |
priority |
Lower number = higher priority (e.g., 1 runs before 5) |
cpu |
CPU units the task needs (out of 100 total) |
ram |
RAM in MB the task needs (out of 512 total) |
space |
Storage in MB the task needs (out of 2000 total) |
duration |
How long the task runs, in seconds |
> add T1 2 20 100 300 10
> add T2 1 30 150 400 8
> add T3 3 10 50 100 5T1starts running first (no other tasks yet).T2has a higher priority (1 < 2), so it pauses T1 and runs immediately, as long as there are enough free resources.T3has a lower priority than both, so it waits in the ready queue until resources are free.
Type refresh anytime to see the current status update.
- Every task needs some CPU, RAM, and storage. The system keeps track of what's available out of a fixed total (100 CPU, 512MB RAM, 2000MB storage).
- When you
adda task:- If nothing is running, it starts right away (if there are enough resources).
- If a task is already running, the scheduler checks priority:
- If the new task has higher priority (a smaller number) or the same priority but less remaining time, it preempts (pauses) the current task and takes over — as long as enough resources are free.
- Otherwise, if there's enough free resources, it starts running alongside; if not, it waits in the ready queue.
- A background thread ("tick") runs every second:
- It counts down the remaining time of the currently active task.
- When a task finishes, its resources are returned to the pool, and the next task (paused or from the ready queue) is started automatically.
- Only one task is truly "active" (counting down) at a time — others are either paused (waiting to resume) or sitting in the ready queue (waiting for resources).
Distributed-Task-Scheduler-OS-Project/
├── dts30.py # Main scheduler program
├── DTS Final Project Report.pdf # Full project report
└── README.md # This file
- This is a simulation — it does not control real hardware or real OS processes
- Only works through the command line (no graphical interface yet)
- Scheduling runs on a single machine (not actually distributed across multiple physical nodes)
- Add a Graphical User Interface (GUI)
- Real-time performance visualization (charts/graphs)
- True network-based distributed scheduling across multiple machines
- Task logging and history/reports
This project was created as a mini lab project for CSE324: Operating System Lab, Department of Computer Science and Engineering, Daffodil International University.
- Mubas Sera Noon
- Md. Ibna Labid
- Md Rizwan Karim Lam
- Md Ahsanur Rahman Nakib
- Fahim Montasir
This project is open for learning purposes. Feel free to fork it, modify it, and build on top of it.