Consider three processes (process id 0, 1, 2 respectively) with compute time…
2006
Consider three processes (process id 0, 1, 2 respectively) with compute time bursts 2, 4 and 8 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turnaround time is?
- A.
13 units
- B.
14 units
- C.
15 units
- D.
16 units
Attempted by 55 students.
Show answer & explanation
Correct answer: A
1. At t=0, remaining times are P0:2, P1:4, P2:8. Longest is P2. Run P2.
2. At t=4, remaining times are P0:2, P1:4, P2:4. Tie-break by lowest PID (P1). Run P1.
3. At t=5, remaining times are P0:2, P1:3, P2:4. Longest is P2. Run P2.
4. At t=6, remaining times are P0:2, P1:3, P2:3. Tie-break by lowest PID (P1). Run P1.
5. At t=7, remaining times are P0:2, P1:2, P2:3. Longest is P2. Run P2.
6. At t=8, remaining times are P0:2, P1:2, P2:2. Tie-break by lowest PID (P0). Run P0.
7. At t=9, remaining times are P0:1, P1:2, P2:2. Tie-break by lowest PID (P1). Run P1.
8. At t=10, remaining times are P0:1, P1:1, P2:2. Longest is P2. Run P2.
9. At t=11, remaining times are P0:1, P1:1, P2:1. Tie-break by lowest PID (P0). Run P0.
10. At t=12, P0 completes. Remaining: P1:1, P2:1. Tie-break by lowest PID (P1). Run P1.
11. At t=13, P1 completes. Remaining: P2:1. Run P2.
12. At t=14, P2 completes.
Turnaround times: P0=12, P1=13, P2=14. Average = (12+13+14)/3 = 13 units.
A video solution is available for this question — log in and enroll to watch it.