Solution (source code)

= Solution

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 \b[<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.