Think of a processor as a single arcade machine shared by several players. A time slice is the bounded interval in which the operating system lets one scheduled task use the CPU before the scheduler may pause it and give another task a turn. section 6.7
During its slice, a task in the Ready state runs unless it performs a blocking operation. When the interval expires, a timer interrupt lets the scheduler preempt the task; the task waits while another runs. section 6.7
Time slices create the experience of multitasking through rapid switching:
- The scheduler divides available processor time among running tasks. section 6.7
- A timer signals the end of a slice and pauses the current task. section 6.8
- Fast interleaving produces concurrent progress even when one processor executes only one task at a time. section 6.8
An arcade machine shared by threads
An arcade-style runtime gives each thread an equal time slice, then passes control to the next thread. With switching around every 10 milliseconds, players perceive simultaneous game activity even though the processor is rapidly executing tasks in turn. section 6.8
Trace task progress across time to see how repeated slices and scheduler switches create the appearance of simultaneous execution. section 6.7
