https://github.com/nihalrt/responsive-queues
Created a c program that runs different tasks in 3 different queues having distinct quantum times. The scheduling is preemptive provided that the current task's remaining burst time is less than that of the new task. Additionally, implemented a boosting mechanism which prevents tasks from waiting indefinitely (starvation).
https://github.com/nihalrt/responsive-queues
c cpu-scheduling
Last synced: 8 months ago
JSON representation
Created a c program that runs different tasks in 3 different queues having distinct quantum times. The scheduling is preemptive provided that the current task's remaining burst time is less than that of the new task. Additionally, implemented a boosting mechanism which prevents tasks from waiting indefinitely (starvation).
- Host: GitHub
- URL: https://github.com/nihalrt/responsive-queues
- Owner: Nihalrt
- Created: 2023-08-29T17:21:41.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-30T13:54:27.000Z (over 2 years ago)
- Last Synced: 2025-05-20T00:11:29.598Z (about 1 year ago)
- Topics: c, cpu-scheduling
- Language: C
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Responsive Queues
## Overview
The `mlfq.c` file is an implementation of a Multi-Level Feedback Queue (MLFQ) scheduling algorithm with round-robin scheduling. This program reads a set of instructions from an input file and simulates the scheduling of tasks among multiple queues with varying priorities.
## Table of Contents
- [Introduction](#introduction)
- [Usage](#usage)
- [Implementation Details](#implementation-details)
- [Compiling the Code](#compiling-the-code)
- [Running the Program](#running-the-program)
- [Sample Input File](#sample-input-file)
- [Sample Output](#sample-output)
## Introduction
The Multi-Level Feedback Queue (MLFQ) is a popular scheduling algorithm that divides tasks into multiple priority queues. Each queue has a different priority level, and tasks move between queues based on their behavior. In this implementation, we use three priority queues with different time quantum values for each queue.
## Usage
To use this program, follow these steps:
1. **Compile the Code**: Compile the `mlfq.c` code to create an executable.
2. **Create an Input File**: Prepare an input file containing a list of instructions for task scheduling.
3. **Run the Program**: Execute the compiled program with the input file as an argument.
4. **View Output**: The program will display the scheduling actions and the status of tasks at each clock tick.
5. **Round Robin Principle**: in a scheduling algorithm that distributes work evenly among all available resources.
## Implementation Details
- The program simulates task scheduling based on the instructions in the input file.
- Tasks are categorized into three priority queues (queues 1, 2, and 3), with decreasing priority.
- The time quantum for each queue is defined by the `QUEUE_TIME_QUANTUMS` array.
- A boost operation is performed periodically to move tasks from lower-priority queues to higher-priority queues.
- The program tracks waiting time and execution time for each task to calculate turnaround time.
- The scheduler selects the task with the highest priority for execution.
- The code handles task arrivals, terminations, and bursts, updating task information accordingly.
## Compiling the Code
Compile the `mlfq.c` code using a C compiler (e.g., GCC) with the following command:
```shell
gcc -o mlfq mlfq.c