Explanation of process and its life cycle:

Process:
                A process is an instance of a computer program that is being executed or in simple words, a process is a program in execution.

- A process is dynamic/active entity.
- A process has limited life span.
- A process contains various resources like memory space, disk, printer, scanner etc. as per its requirement.

Explanation of process life cycle:


- A process change its states during time duration of its execution.
- A process state indicates current activity of process.
- Process life cycle is also called process states.

Each process may be in one of the following states during its life span.

* New:
- When a process is first created it occupies 'New' state. In this state, process awaits to enter in 'Ready' state.

* Ready:
- A process, which is in 'Ready' state has been loaded into main memory.
- In this state, process awaits for execution on a CPU.
- It is possible that more than one processes may be in 'Ready' state in any instance of time.

* Running:
- A process, which is in 'Running' state is currently executing on a CPU.
- In a single processor system, one and only one process can be executing in this state at a time.

* Waiting:
- A process, which is in 'Waiting' state is waiting for some Input/Output completion or some event to occur. For example, consider that some process requires printer to print documents but printer is being used by some other process.
- So process will wait and it will be in this state till the printer becomes free.

* Terminated:
- When process terminated, it acquires this state.
- A process can terminate by completing its execution or it can be killed explicitly.

Following table shows state transitions occur on various event of process. 

From State
Event
To State
New
Accepted
Ready
Ready
Scheduled / Dispatch
Running
Running
Need Input/Output
Waiting
Running
Scheduler time out
Ready
Running
Completion/Error/Killed
Terminated
Waiting
Input/Output completed or wake up event
Ready

0 Comments