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?
- A. 5.2 ms and 10.4 ms
- B. 4.6 ms and 9.8 ms
- C. 5.2 ms and 15.6 ms
- 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
- 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…
- Processes (arrival, burst, priority; a smaller number means higher priority): A (0, 9, 3), B (1, 4, 1), C (3, 6, 4), D (5, 2, 2), E (8, 5…
- Processes (arrival, burst) in ms: P1 (0, 6), P2 (2, 5), P3 (4, 2), P4 (5, 8), P5 (7, 3). They are scheduled by non-preemptive Highest…
- A multilevel feedback queue has Q0 (Round Robin, quantum 2), Q1 (Round Robin, quantum 4) and Q2 (FCFS). New processes enter Q0. A process…
- Three processes each run CPU burst, I/O burst, CPU burst (in ms): P1 arrives at 0 with 5, 4, 3; P2 arrives at 2 with 3, 6, 2; P3 arrives…
- Reference string: 2, 7, 2, 4, 1, 7, 3, 2, 4, 5, 1, 2, 7, 3, 5, 2. With 4 frames, initially empty, how many page faults do FIFO, LRU and…