In: Computer Science
What are the major states a process can move between and what the events that cause process to move in and out of each state ? What are the major types of PSU schedulers? Explain how the context-switch process is performed and when.
There are several states of a process from creation of that process and exit , that are conducted in operating system.
The states are new, Ready, Run, Blocked or Wait, Terminated or Completed , Suspend ready and Suspend wait or suspend blocked .
After a new process is created in the new state , the event Admit helps to get it ready .Then from the ready state , it is dispatched for running or if timeout while running then goes back to the ready state. If the process were swapped out of memory and placed onto external storage , the process goes to the suspend ready state, and when activated ,goes back to the ready state again for running. Whenever the process requests access to any input/output or need access to a memory which is slready acqiured by another process, it goes to the blocked/wait state .Once the opeartion is completed it goes back to the ready state for running. And if there occurs a problem completeing the operation or there is lack of memory then the process goes to suspended block/wait state then to suspended ready state and then goes to ready state again. Lastly The process which are completed executing, the Release event helps them to exit .
There are different types of schedulers -
a) Long term - performance
b) Short term - context switching time
c) Medium term - swapping time
Context - switching process--
There are different cases when context switching occurs -
a) When a current process is running and one another process needs to be completed immediately, so the current process save its works and the different process starts running.This usually occurs in a multitasking environment.
b) When any interruption occurs while executing a process
c) When a transition is required between user mode and the kernel mode , then a context switching occurs.
Steps of context switching-
a) Save all the works and the context of the process that is currently running and then updating the process control block.
b) Then Move to the process control block of that particular process into the appropriate queue.
c) Then it selects a new process
d) Update the process control block for that particular process
e) The memory management data structures also get updated as required.
f) Using the previous values of the process control block and registers it stores the progress that was in wait state and started execution.