Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

# For the following jobs calculate average waiting time for (i) Round Robin (q=2) (ii) Shortest job first algorithms

Let’s assume that all processes arrive at time 0 for simplicity.

## (i) Round Robin (RR) Scheduling (q = 2):

Step 1: Execute processes in a round-robin fashion with a time quantum (q) of 2 until all processes complete.

Time Quantum = 2

Step 2: Calculate the waiting time (WT) for each process.

• WT(P1) = 0
• WT(P2) = 8
• WT(P3) = 6
• WT(P4) = 10

Step 3: Calculate the average waiting time (AWT):

AWT = (WT(P1) + WT(P2) + WT(P3) + WT(P4)) / Number of processes
AWT = (0 + 8 + 6 + 10) / 4
AWT = 24 / 4
AWT = 6

## (ii) Shortest Job First (SJF) Scheduling:

Step 1: Execute processes in ascending order of burst time (shortest first) until all processes complete.

Step 2: Calculate the waiting time (WT) for each process.

• WT(P1) = 16
• WT(P2) = 14
• WT(P3) = 0
• WT(P4) = 4

Step 3: Calculate the average waiting time (AWT):

AWT = (WT(P1) + WT(P2) + WT(P3) + WT(P4)) / Number of processes
AWT = (16 + 14 + 0 + 4) / 4
AWT = 34 / 4
AWT = 8.5