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
OS moves to Preemptive Multitasking
Preemptive Multitasking
- Ensure no Process (进程) can hog the CPU forever
Mechanism
- Before jumping to program code, the OS sets the Timer Chip to trigger an Hardware interrupts (外中断) after some period of time
- The OS switches to User Mode and jumps to the next Instruction of the program
- When the Timer Chips elapses, it triggers a Hardware interrupts (外中断) to switch to Kernel Mode and jump to OS code
- The OS can now save where the program left off, load a different program, and repeat the process
Terminologies
Time-Sharing
- A Implementation of Concurrency (并发)
- A specific implementation of Multi-tasking when there is only a single resource - single CPU, achieve with quick Context Switch
- All Time-sharing systems are Multi-programming systems
- Allow multiple remote users to run jobs on the same computer at the same time