Operating Systems Lab Manual / OS Round Robin C Program

Program Name Write a C Program for CPU scheduling algorithm Round Robin
Theory
In Round Robin the processor time is shared amoung all the processes and the 
shared processor time is called as time slice.

No. of time slice for process (n) = burst time process (n)/time slice
Waiting time for process (n) = waiting time of process(n-1)+ burst time of process(n-1 )
+ the time difference in getting the CPU from process (n-1)
Turnaround time for process(n) = waiting time of process(n) + burst time of process(n)
+ the time difference in getting CPU from process(n).
Average waiting time = Total waiting Time / Number of process
Average Turnaround time = Total Turnaround Time / Number of process Step
Program
Input
Enter number of processes: 3
Enter Burst Time for process 1  = 24
Enter Burst Time for process 2  = 3
Enter Burst Time for process 3  = 3
Enter Time slice size: 3
Output
The Average Turnaround time: 15.000000
The Average Waiting time: 5.000000 

Process Burst Time   Waiting Time    Turn Around Time
1         24              6                30 
2         3               3                 6 
3         3               6                 9 


Home     Back