Given CPU time slice of \(2ms\) and following list of processes.…

2019

Given CPU time slice of \(2ms\) and following list of processes.

\(\begin{array}{ccc} \text{Process} & \text{Burst time} & \text{Arrival time} \\ & \text{(ms)} \\ p_1 & 3 & 0 \\ p_2 & 4 & 2 \\ p_3 & 5 & 5 \end{array}\)

Find average turnaround time and average waiting time using round robin CPU scheduling?

Answer: B. 5.66,1.66Solution: Use Round Robin scheduling with time quantum = 2 ms. Gantt chart and remaining times: 0–2: p1 (remaining 1); 2–4: p2 (remaining 2); 4–5: p1…

  1. A.

    4,0

  2. B.

    5.66,1.66

  3. C.

    5.66,0

  4. D.

    7,2

Attempted by 239 students.

Show answer & explanation

Correct answer: B

Solution:

Use Round Robin scheduling with time quantum = 2 ms.

Gantt chart and remaining times:

0–2: p1 (remaining 1); 2–4: p2 (remaining 2); 4–5: p1 (completes at 5); 5–7: p2 (completes at 7); 7–9: p3 (remaining 3); 9–11: p3 (remaining 1); 11–12: p3 (completes at 12).

  • p1: completion time = 5 ms; turnaround = completion − arrival = 5 − 0 = 5 ms; waiting = turnaround − burst = 5 − 3 = 2 ms.

  • p2: completion time = 7 ms; turnaround = 7 − 2 = 5 ms; waiting = 5 − 4 = 1 ms.

  • p3: completion time = 12 ms; turnaround = 12 − 5 = 7 ms; waiting = 7 − 5 = 2 ms.

Average turnaround time = (5 + 5 + 7) / 3 = 17 / 3 ≈ 5.67 ms.

Average waiting time = (2 + 1 + 2) / 3 = 5 / 3 ≈ 1.67 ms.

Answer: average turnaround ≈ 5.67 ms, average waiting ≈ 1.67 ms.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…