We read your photo as:

Draw Gantt charts and calculate average waiting times for SRTN and RR scheduling algorithms given specific processes.

Computer Science

ScanSolve AI Answer

c. i) Draw the Gantt charts for Shortest Remaining Time Next (SRTN) and Round Robin (RR) scheduling strategies using a time slice of 4 milliseconds.

Given processes:

  • P1: Arrival Time = 0, Burst Time = 8
  • P2: Arrival Time = 1, Burst Time = 4
  • P3: Arrival Time = 2, Burst Time = 9
  • P4: Arrival Time = 3, Burst Time = 5

SRTN Gantt Chart:

P1P2P2P2P2P4P4P4P4P4P1P1P1P1P1P1P1P3P3P3P3P3P3P3P3P3
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Round Robin (RR) Gantt Chart (Time Slice = 4ms):

P1P2P3P4P1P3P4P3
0 4 8 12 16 20 24 25 26

c. ii) Calculate the average waiting times of each of the processes in each algorithm.

SRTN Algorithm:

  • P1:
    • Completion Time: 17
    • Turnaround Time: 17−0=1717 - 0 = 17
    • Waiting Time: 17−8=917 - 8 = 9 ms
  • P2:
    • Completion Time: 5
    • Turnaround Time: 5−1=45 - 1 = 4
    • Waiting Time: 4−4=04 - 4 = 0 ms
  • P3:
    • Completion Time: 26
    • Turnaround Time: 26−2=2426 - 2 = 24
    • Waiting Time: 24−9=1524 - 9 = 15 ms
  • P4:
    • Completion Time: 10
    • Turnaround Time: 10−3=710 - 3 = 7
    • Waiting Time: 7−5=27 - 5 = 2 ms

Total Waiting Time = 9+0+15+2=269 + 0 + 15 + 2 = 26 ms
Average Waiting Time (SRTN) = 264=6.5 ms\frac{26}{4} = \boxed{6.5 \text{ ms}}

Round Robin (RR) Algorithm (Time Slice = 4ms):

  • P1:
    • Completion Time: 20
    • Turnaround Time: 20−0=2020 - 0 = 20
    • Waiting Time: 20−8=1220 - 8 = 12 ms
  • P2:
    • Completion Time: 8
    • Turnaround Time: 8−1=78 - 1 = 7
    • Waiting Time: 7−4=37 - 4 = 3 ms
  • P3:
    • Completion Time: 26
    • Turnaround Time: $26 - 2
Was this helpful?

Still stuck on this one?

Ask a follow-up, and the answer starts from this question.

Got a different question?Ask your own question
Handwritten step-by-step solution preview

Handwritten Step-by-Step Solution

Get this as a handwritten image on WhatsApp — like a tutor wrote it for you.

Try on WhatsApp