In: Computer Science
1.
a. Explain in details why the Operating System switches the process from Running state to Waiting state when it issues any I/O operation.
b. Describe a situation where the Operating System switches the process from the Running state to Ready state.
Process:
A process is not only a program under execution but it is the active state of the program when it is executing and it has its own Process Control Block.
A process requires other resources like memory, CPU, hard disk, and Input/Output, etc.
A process has five states as given below:
The ready state of a process means the process is waiting for the CPU to be assigned. The new state processes are picked from the secondary memory by the operating system and put into the main memory.
The short term scheduler selects the process from the ready queue.
The executing or running state of a process means the process is running and CPU is allocated to this process to complete the required action done by this process.
The waiting state is a state in which the process is waiting for some resources that may behold by the other process. If the process gets the required resources then it will go into the ready state for further execution.
a.
While a process is running then it may require more resources but if the resources are not available at that time then the process will switch from running state to waiting state. If the required resources will be available then the process will switch from the waiting state to the ready state and will wait for the CPU allocation.
b.
If a process is running and this process has all resources as required but a high priority process enters into the system and the scheduling algorithm is preemptive. The CPU will be allocated to the high priority process and the currently executing process will switch from the running state to the ready state.