An input-output-bound process spends much of its time waiting for input-output, often with short CPU bursts between waits. A CPU-bound process spends most of its time doing useful CPU computation, with comparatively little blocking. These descriptions concern the bottleneck in the workload; an I/O-bound process still needs CPU time.
With nonpreemptive scheduling, a running process retains the processor until it finishes its current CPU burst, blocks or voluntarily yields. With preemptive scheduling, the operating system may suspend a runnable process and select another one.
Time-slice preemption needs a hardware timer delivering an interrupt after bounded execution time, so control returns to the scheduler even if the running program never yields. Saving and restoring the execution context then lets the interrupted process resume later. The timer mechanism should remain under operating-system control.
Assume both processes are available at time zero and run the listed order, A followed by B, with no overlap even during input-output. A takes ms; B then takes ms. Thus
The scheduling turnaround time includes the time waiting before a process first runs. Reversing the serial order would leave the total at 23 ms but change completion times to 7 and 23 ms, with mean 15 ms. If arrivals were instead delayed until each serial launch, that would define a different turnaround measurement; the simultaneous-arrival convention is used for comparing the schedulers below.
With the given ready-order rule and A first, the CPU timeline in milliseconds is
A performs input-output during and ; B does so during and . In particular, B becoming ready at time 7 does not interrupt A's ongoing nonpreemptive burst. The completion times are and , giving
There are 15 ms of useful CPU execution and 2 ms of idle time on this particular timeline.
Figure 1.
CPU timelines and I/O waits for the two scheduling policies
. Both processes arrive at zero. Readiness determines queue order; A wins initial ties. The displayed completion times give mean turnarounds 16.5 ms without preemption and 14 ms with a two-millisecond quantum. Details.
Use round-robin scheduling with scheduling quantum 2 ms. A's first burst is split by B, and A's second burst is also interrupted once. The resulting CPU intervals are
A blocks for input-output during and ; B blocks during and . At time 8, B joins the ready queue while A uses the remainder of its current quantum; B runs at time 9. No other process is runnable during A's final four milliseconds, so A can continue across the time-16 quantum boundary. Consequently
The preemptive policy improves B's scheduling turnaround time from 17 to 10 ms and the mean from 16.5 to 14 ms. A finishes later, at 18 rather than 16 ms, and the total completion time rises from 17 to 18 ms. Thus preemption improves mean turnaround here; nonpreemption gives the shorter makespan here.
The result illustrates different scheduling objectives, not a universal winner. These calculations assume negligible context switch overhead; charging for the additional switches could change the comparison. Both policies perform the same 15 ms of useful CPU work.

Articles by others on the same topic (0)

There are currently no matching articles.