Project ForgeSign up free
Operating Systems
Process Scheduling
GATE 2014
Expert

Consider the following set of processes to be scheduled on a single CPU (all times in ms): A (arrival 0, execution 6), B (arrival 3, execution 2), C (arrival 5, execution 4), D (arrival 7, execution 6), E (arrival 10, execution 3). Using the shortest remaining time first scheduling algorithm, the average process turnaround time (in msec) is __________.

7.2 ms(± 0.1 accepted)

Explanation

Trace: A runs 0-3 (remaining 3 left when B arrives at t=3 with remaining 2 < 3, so preempt). B runs 3-5, completes (turnaround 5-3=2). At t=5, A(rem 3) vs new arrival C(rem 4): run A, 5-7. At t=7, D arrives (rem 6); A now has rem 1 (< C's 4, D's 6), so A finishes 7-8, turnaround 8-0=8. At t=8, C(rem 4) < D(rem 6): run C. At t=10, E arrives (rem 3); C now has rem 2 (< E's 3), so C continues to completion at t=12, turnaround 12-5=7. At t=12, E(rem 3) < D(rem 6): run E, 12-15, turnaround 15-10=5. Finally D runs 15-21, turnaround 21-7=14. Average = (8+2+7+14+5)/5 = 36/5 = 7.2 ms.

Source: GATE CS 2014 (Session 1) (2014)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free