CPU Scheduling

Answer & solution
Official answer: 5.25
Step through it (2 schedules)
Worked explanation
Turnaround time is completion minus arrival, not just waiting time. With all arrivals zero, completion times can be averaged directly. SJF Gantt timeline: 0—P3—2—P4—6—P2—13—P1—21. RR timeline: 0—P1—4—P2—8—P3—10—P4—14—P1—18—P2—21. After their first slices P1 has 4 ms remaining and P2 has 3; P3 and P4 finish in their first slices and leave the queue. In process order P1,P2,P3,P4, completions are (21,13,2,6) for SJF and (18,21,10,14) for RR. Sums 42 and 63 divided by 4 give the required difference 5.25 ms.
Derivation and answer
SJF executes P3, P4, P2, P1, completing them at 2, 6, 13, 21ms. Since arrivals are all zero, average turnaround is 42/4=10.5ms. RR with quantum 4 executes P1[0, 4], P2[4, 8], P3[8, 10], P4[10, 14], P1[14, 18], P2[18, 21]. Completion times are 18, 21, 10, 14ms, averaging 63/4=15.75ms. The absolute difference is 15.75−10.5=5.25ms, with zero context-switch overhead as conventionally assumed.