CS FundamentalsVery hardProduct company interview · GATE level

Processes (times in ms): A (arrival 0, burst 9), B (arrival 1, burst 4), C (arrival 3, burst 6), D (arrival 5, burst 2), E (arrival 8, burst 5). They are scheduled by SRTF (preemptive shortest remaining time first; ties go to the earlier arrival). What are the average waiting time and the average turnaround time?

  1. A. 5.2 ms and 10.4 ms
  2. B. 4.6 ms and 9.8 ms
  3. C. 5.2 ms and 15.6 ms
  4. D. 6.8 ms and 12.0 ms

Correct answer: A. 5.2 ms and 10.4 ms

Gantt chart: A 0-1, B 1-5 (B's 4 beats A's remaining 8), D 5-7, C 7-13 (at 7 C has 6 left against A's 8), E 13-18, A 18-26. At time 8, E arrives with 5 against C's remaining 5; the tie goes to C, the earlier arrival (breaking it the other way swaps C's and E's waits, 4 + 5 versus 9 + 0, and leaves the averages unchanged). Completion times A 26, B 5, C 13, D 7, E 18, so turnarounds 26, 4, 10, 2, 10 (average 10.4) and waits 17, 0, 4, 0, 5 (average 5.2). The usual slip is to let A run at time 7: C's 6 remaining beats A's 8.

More Operating Systems questions

Exams that ask this topic