Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Multi-Level Feedback Queue (MLFQ) CPU Scheduler

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.


Features

  • 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

Scheduling Rules

  • 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.

Technologies Used

  • C
  • GCC
  • Ubuntu Linux

Project Structure

MLFQ-CPU-Scheduler/
│
├── scheduler.c
├── processes.txt
└── README.md

Compilation

gcc scheduler.c -o scheduler

Running the Program

./scheduler

The program expects a file named processes.txt in the same directory.


Concepts Demonstrated

  • 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

Notes

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.

About

C implementation of a Multi-Level Feedback Queue (MLFQ) CPU scheduler with Round Robin and FCFS scheduling.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages