Unit 2 .
One of abstractions provided by operating system to user is a running program called process. Users might run more than one program at once so that a system can run many process at the same time. Through virtualizing the CPU, each process will have the illusion that it has owning the CPU.(Arpaci-Dusseau, R. & Arpaci-Dusseau, A. , 2012)
This illusion is created by OS process scheduler and preemption mechanism.
Precess scheduling is an OS task that schedules processes of different states and allocates a time interval of CPU for each process by using various techniques as time sharing, context switch, space sharing(Williams, 2021). Precess scheduler will pick one process to execute, or stop a running one and run another by using these techniques. This allows users to run concurrent processes at a time(Arpaci-Dusseau, R. & Arpaci-Dusseau, A. , 2012). “Preemption is the act of temporarily interrupting an executing tasks, with the intention of resuming it at a later time.(Wikimedia Foundation, 2021)” It is kind of a scheduling policy of higher priority tasks which related with historical information, workload knowledge, and performance metrics. The key parts of preemption mechanisms are time slice and system support. Unlike the mechanism of time sharing, time slice indicates “the period of time for which a process is allowed to run in a preemptive multitasking system(Wikimedia Foundation, 2021)". After each time slice chosen the next running process, it will be run once by scheduler.
Summarizing, process scheduling is dealing with the problem of how OS virtualizes the CPU by implementing time/space sharing, context switch methods or protocols ( low-level machinery) , while preemption is working on “which to run/execution” by utilizing time slice and scheduling policy(high-level intelligence) (Arpaci-Dusseau, R. & Arpaci-Dusseau, A. , 2012).
To implement virtualization of CPU well, we need to combine “how” methods and “which to run” intelligences well.
references:
Arpaci-Dusseau, R. & Arpaci-Dusseau, A. (2012). Operating Systems: Three Easy Pieces. Madison, WI: University of Wisconsin-Madison. Available at http://pages.cs.wisc.edu/~remzi/OSTEP/
Williams, L. (2021, November 1). Process scheduling: Long, medium, short term scheduler. Guru99. Retrieved November 22, 2021, from https://www.guru99.com/process-scheduling.html.
Wikimedia Foundation. (2021, September 9). Preemption (computing). Wikipedia. Retrieved November 22, 2021, from https://en.wikipedia.org/wiki/Preemption_(computing).