Abstract


  • A logical extension of Multi-programming

  • Ability of computer executing multiple tasks at the same time by giving each Process (进程) a very small slice of CPU time


  • Focus on improving user experience

  • Can be implemented on computers that have a single(Time-Sharing) or multiple CPU

Corporative Multitasking

  • Rather than OS decides when to preempt Process (进程). Process gives up CPU and let other Process to run

Preemptive Multitasking

Mechanism

  1. Before jumping to program code, the OS sets the Timer Chip to trigger an Hardware interrupts (外中断) after some period of time
  2. The OS switches to User Mode and jumps to the next Instruction of the program
  3. When the Timer Chips elapses, it triggers a Hardware interrupts (外中断) to switch to Kernel Mode and jump to OS code
  4. The OS can now save where the program left off, load a different program, and repeat the process

Terminologies


Time-Sharing