RRS (Round Robin Scheduling)



Objective:
To implement ‘Round Robin’ CPU scheduling algorithm.
Theory:                                
Round Robin is the preemptive process scheduling algorithm. Each process is provided a fix time to execute, it is called a quantum. Once a process is executed for a given time period, it is preempted and other process executes for a given time period. Context switching is used to save states of preempted processes.
Example:
Process
Burst Time
P1
24
P2
3
P3
3
The Gantt chart for the schedule having time slice=4 is:
Algorithm:
1.      Declare the array size and get the number of elements to be inserted.
2.      Get the value of quantum and burst time of each process.
3.      Set the time sharing system with preemption.
4.      Declare the queue as a circular.
5.      Make the CPU scheduler goes around the ready queue allocating CPU to each process for the time interval specified.
6.      Make the CPU scheduler picks the first process and sets time to interrupt after quantum expired dispatches the process.
7.      If the process has burst less than the time quantum than the process releases the CPU.
Task:
Write a C++ code/Linux shell script to implement CPU scheduling algorithm Round Robin.

Post a Comment

0 Comments