This repository contains the implementation of various Task Scheduling Algorithms in C++. It includes algorithms such as First-Come-First-Serve (FCFS), Shortest Job First (SJF), Round Robin (RR), Fuzzy Round Robin, and Ratio-based Scheduling. The program reads tasks with arrival times and burst times, processes them, and outputs the scheduling order along with the respective statistics such as completion time, waiting time, and turnaround time.
- FCFS (First-Come-First-Serve): Processes tasks in the order of their arrival times.
- SJF (Shortest Job First): Prioritizes tasks with the shortest burst time.
- RR (Round Robin): Distributes CPU time among tasks in a round-robin fashion with a time quantum.
- Fuzzy RR: A variation of Round Robin with dynamic quantum adjustment based on a fuzzy range.
- Ratio-Based Scheduling: Schedules tasks based on a ratio of burst time and arrival time.
- Task ID: Unique identifier for each task.
- Arrival Time: Time at which the task arrives.
- Burst Time: CPU burst time required by the task.
- C++
- g++ (GNU Compiler Collection)
Processes tasks in the order of arrival. It is the simplest scheduling algorithm but can lead to high waiting times for tasks with longer burst times.
Schedules tasks based on the burst time, with the shortest burst time processed first. It is optimal in terms of minimizing waiting time but requires knowledge of burst time in advance.
Each task is assigned a fixed time quantum. If the task does not complete within the quantum, it is pushed back into the queue for the next round.
An extension of the RR algorithm where the time quantum is randomly adjusted within a specified fuzzy range, making the scheduling dynamic.
Tasks are prioritized based on a calculated ratio of burst time to the time passed since arrival. This dynamic approach helps improve task prioritization over time.
- g++ Compiler
- Linux or MacOS (for shell script usage)
- Clone the repository or place your
task_scheduler.cpp
file in a directory. - Save the provided script as
run_task_scheduler.sh
. - Give execution permission to the script:
chmod +x run_task_scheduler.sh
## 📊 Output
Once executed, the program will display the task scheduling order with completion, turnaround, and waiting times. Example output format:
```text
0ms--(Task:1)--2ms--(Task:3)--5ms--(Task:2)--end
Average Turnaround Time: 4.5 Average Waiting Time: 2.0
- Add support for Priority Scheduling algorithm.
- Improve UI/UX to visualize the task scheduling order more intuitively.
- Implement multi-core CPU scheduling for better performance and scalability.
We welcome contributions to enhance the project!
- Fork the repository.
- Create a new branch for your feature or fix.
- Submit a pull request with a detailed description of your changes.
For any queries or feedback, feel free to reach out at:
a_jaiswal@ece.iitr.ac.in.