Round Robin RR - CPU Scheduling
ROUND ROBIN CPU SCHEDULING
1. AIM
To simulate the Round Robin (RR) CPU Scheduling Algorithm using arrival time, burst time and a fixed time quantum, and compute:
-
Completion Time (CT)
-
Turnaround Time (TAT)
-
Waiting Time (WT)
-
Average Waiting Time (AWT)
2. THEORY
Round Robin Scheduling
-
A preemptive CPU scheduling algorithm commonly used in time-sharing systems.
-
Each process is assigned a fixed Time Quantum (TQ).
-
Processes are executed in circular order.
-
If a process's burst time is greater than the time quantum, the CPU is taken away and given to the next process in the ready queue.
Advantages
-
Fair scheduling — no starvation.
-
Good for time-sharing systems.
Disadvantages
-
Large TQ → behaves like FCFS
-
Too small TQ → too many context switches
Formulae
-
Turnaround Time (TAT)
-
Waiting Time (WT)
3. ALGORITHM
-
Input number of processes n.
-
For each process:
-
Process ID
-
Arrival Time (AT)
-
Burst Time (BT)
-
-
Input Time Quantum (TQ).
-
Maintain a ready queue.
-
At each time:
-
Add all processes that have arrived.
-
Dequeue the process at the front.
-
Execute for min(BT, TQ) time.
-
If remaining BT > 0, enqueue it again.
-
Else mark the process as completed and compute CT.
-
-
Compute TAT, WT and Average WT.
-
Print the results.
4. C PROGRAM – ROUND ROBIN USING STRUCTURES
5. SAMPLE INPUT
6. GANTT CHART
Time Quant → 2 units
7. SAMPLE OUTPUT
8. RESULT
The Round Robin CPU Scheduling algorithm was successfully executed.
The program computed:
-
Completion Time
-
Turnaround Time
-
Waiting Time
-
Average Waiting Time
A Gantt chart was drawn to clearly represent process execution order.
Comments
Post a Comment