A C implementation of the Multi-Level Feedback Queue (MLFQ) CPU Scheduling Algorithm developed as part of an Operating Systems assignment. The program simulates process scheduling using multiple priority queues, dynamic priority adjustment, and different scheduling policies while calculating standard CPU scheduling metrics.
- Reads process information from
processes.txt - Implements a 3-level Multi-Level Feedback Queue (MLFQ)
- Queue 1: Round Robin (Time Quantum = 2)
- Queue 2: Round Robin (Time Quantum = 4)
- Queue 3: First Come First Served (FCFS)
- Dynamic process promotion and demotion
- Handles process interruptions based on the provided disrupt flag
- Generates a Gantt Chart showing CPU execution
- Calculates:
- Completion Time (CT)
- Turnaround Time (TAT)
- Waiting Time (WT)
- Displays Average Waiting Time and Average Turnaround Time
- All new processes enter Queue 1.
- A process that uses its full quantum in Queue 1 moves to Queue 2.
- A process that uses its full quantum in Queue 2 moves to Queue 3.
- Queue 3 executes processes using FCFS until completion.
- Every third interruption promotes a process to the next higher priority queue (if applicable).
- Newly arriving processes are checked after every time slice.
- The CPU always schedules from the highest-priority non-empty queue.
- C
- GCC
- Ubuntu Linux
MLFQ-CPU-Scheduler/
│
├── scheduler.c
├── processes.txt
└── README.md
gcc scheduler.c -o scheduler./schedulerThe program expects a file named processes.txt in the same directory.
- Operating Systems
- CPU Scheduling
- Multi-Level Feedback Queue (MLFQ)
- Round Robin Scheduling
- FCFS Scheduling
- Queue Implementation
- Circular Queues
- File Handling in C
- Process Scheduling Simulation
This project was developed as part of an Operating Systems course to demonstrate CPU scheduling algorithms through simulation. The scheduler is implemented entirely in C without using built-in data structures, following the assignment requirements.