Preemption
Preemption is when the OS reeclaims of a resource from a process before the process has finished using it., i.e. triggers a Process Switch.
Fundamental Concept
Preemption is a FUNDAMENTAL principle behind how every modern OS functions.
In this case, the resource is the processor itself. The process is executing and could continue to execute, but is preempted so another process can be executed.
Preemption transitions a process from the Running → Ready state (see Process State for reminder).
When does preemption happen?
The most common reason for this transition is that the running process has reached the maximum allowable time for uninterrupted execution (max Time Quanta); virtually all multiprogramming operating systems impose this type of time discipline.
Of particular importance is the case in which the OS assigns different levels of priority to different processes.
Suppose, for example, process A is running at a given priority level, and process B, at a higher priority level, is blocked. If the OS learns that the event upon which process B has been waiting has occurred, thus moving B to a ready state, then it can interrupt process A and dispatch process B. We say that the OS has preempted the process.
Finally, a process may voluntarily release control of the processor. An example is a background process that periodically performs some accounting or maintenance function.