Solving the Round Robin (RR) Scheduling Algorithm

Given Data:

  1. Processes: P1, P2, P3
  2. Burst Times (BT):
    • P1 = 24
    • P2 = 3
    • P3 = 3
  3. Time Quantum = 4

Step 1: Gantt Chart Construction

Using a time quantum of 4, we allocate the CPU to each process in a round-robin manner.

  1. Time Slice 1:
    • P1 executes for 4 units (remaining = 24 – 4 = 20).
    • P2 completes execution (remaining = 3 – 3 = 0).
    • P3 completes execution (remaining = 3 – 3 = 0).
  2. Time Slice 2:
    • P1 executes for another 4 units (remaining = 20 – 4 = 16).
  3. Repeat Process:
    • P1 continues to execute until it completes.

Gantt Chart

TimeProcess
0 – 4P1
4 – 7P2
7 – 10P3
10 – 14P1
14 – 18P1
18 – 22P1
22 – 26P1
26 – 30P1

Step 2: Completion Time

  1. P1: Finishes at t=30t = 30t=30
  2. P2: Finishes at t=7t = 7t=7
  3. P3: Finishes at t=10t = 10t=10

Step 3: Turnaround Time (TAT)

Step 3: Turnaround Time (TAT)

TAT=Completion Time (CT)−Arrival Time (AT)

ProcessCompletion Time (CT)Arrival Time (AT)Turnaround Time (TAT)
P130030
P2707
P310010

Step 4: Waiting Time (WT)

WT=TAT−Burst Time (BT)

ProcessTurnaround Time (TAT)Burst Time (BT)Waiting Time (WT)
P130246
P2734
P31037

Final Results:

ProcessBurst Time (BT)Completion Time (CT)Turnaround Time (TAT)Waiting Time (WT)
P12430306
P23774
P3310107

Average Times:

  1. Average Turnaround Time (TAT):Average TAT=30+7+10/3=15.67
  2. Average Waiting Time (WT):Average WT=6+4+7/3=5.67

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *