State Diagram
The process, from its creation to completion, passes through various states. The minimum number of states is five.
The names of the states are not standardized although the process may be in one of the following states during execution.
1. New
A program that is going to be picked up by the OS into the main memory is called a new process.
2. Ready
Whenever a process is created, it directly enters in the ready state, in which, it waits for the CPU to be assigned. The OS picks the new processes from the secondary memory and put all of them in the main memory.
The processes which are ready for the execution and reside in the main memory are called ready state processes. There can be many processes present in the ready state.
3. Running
One of the processes from the ready state will be chosen by the OS depending upon the scheduling algorithm. Hence, if we have only one CPU in our system, the number of running processes for a particular time will always be one. If we have n processors in the system then we can have n processes running simultaneously.
4. Block or wait
From the Running state, a process can make the transition to the block or wait for state depending upon the scheduling algorithm or the intrinsic behavior of the process.
When a process waits for a certain resource to be assigned or for the input from the user then the OS move this process to the block or waits for state and assigns the CPU to the other processes.
5. Completion or termination
When a process finishes its execution, it comes in the termination state. All the context of the process (Process Control Block) will also be deleted the process will be terminated by the Operating system.
6. Suspend ready
A process in the ready state, which is moved to secondary memory from the main memory due to a lack of resources (mainly primary memory) is called the suspended ready state.
If the main memory is full and a higher priority process comes for the execution then the OS has to make the room for the process in the main memory by throwing the lower priority process out into the secondary memory. The suspend ready processes remain in the secondary memory until the main memory gets available.
7. Suspend wait
Instead of removing the process from the ready queue, it's better to remove the blocked process which is waiting for some resources in the main memory. Since it is already waiting for some resource to get available hence it is better if it waits in the secondary memory and makes room for the higher priority process. These processes complete their execution once the main memory gets available and their wait is finished.
Operations on the Process
1. Creation
Once the process is created, it will be ready and come into the ready queue (main memory) and will be ready for execution.
2. Scheduling
Out of the many processes present in the ready queue, the Operating system chooses one process and starts executing it. Selecting the process which is to be executed next, is known as scheduling.
3. Execution
Once the process is scheduled for execution, the processor starts executing it. The process may come to the blocked or wait for the state during the execution then in that case the processor starts executing the other processes.
4. Deletion/killing
Once the purpose of the process gets over then the OS will kill the process. The Context of the process (PCB) will be deleted and the process gets terminated by the Operating system.
Related Questions & Answers
- What are the Process States in Operating System?
- Write about Process Control Block.
- Write Various Operating System Services.
- What is the requirement to solve the Critical Section Problem?
- Write about the Priority Inversion Problem.
- Write various multithreading models.
- Discuss preemptive scheduling.
- Consider the following set of processes........
- Write about Semaphores. Explain its properties along with drawbacks.
- Write necessary conditions for arise of Deadlock.
- Define the following Terms: Mutual Exclusion, Thrashing, Thread
- Explain the features of Time sharing system.
- What is an operating system? Give the view of OS as a resource manager.
- Explain the following UNIX Commands: (a) grep (b) chmod (c) finger (d) cat (e) sort
- What is the thread? Explain thread Structure? And explain any one type of thread in detail.
- What is PCB? Discuss its major fields.
- List the four events that cause processes to be created. Explain each in brief.
- Explain the producer-consumer problem and its solution using the monitor.
- List Deadlock recovery techniques and explain any one of them.
- Write a short note in Critical Section.
- Explain context switching.
- Differentiate between Multi-Programming and Multi-Processing System.
- Write different types of system calls?
- What is a scheduler? Explain queuing diagram representation of process scheduler.
- Define the following Terms: Throughput, Waiting Time, Turnaround Time, Response Time.
- What is deadlock? List the conditions that lead to deadlock.
- Explain Banker’s algorithm for multiple resources with examples.
- What is Semaphore? Give the implementation of Bounded Buffer.
- What is Mutex? Write pseudocode to achieve mutual exclusion using Mutex.
- Explain the IPC problem. Explain the Dining Philosopher problem.