Process in OS

In computers, any program in execution is known as a process. A process is basically a program in execution. The execution of a process must progress in sequential order. 

A process can also be defined as an entity that represents the basic unit of work to be implemented in the system.

A computer program is made up of a group of instructions, so a process is the actual execution of those instructions. Multiple processes may be linked with the same program.

A process can be executed by one or more other processes or lightweight processes (LWP). The lightweight process (LWP) is also called a thread. A thread contains program code and data (Here data part refers to the activity to be performed ). A process can be made up of multiple threads, this depends on OS architecture.

In computing, a process is the instance of a computer program executed by one or many threads. It contains the program code and its activity. Depending on the operating system (OS), a process may comprise multiple threads of execution that execute instructions concurrently.

A process passed through different states to reach its goal. Every process has its own PCB (Process Control Block). PCB contains all information related to a process like a process id, process state, etc.

Different states are passed via a process as follows:



Process States Diagram



New

This is the initial state where a process is being created.  

Ready

After the NEW state, the next state is the Ready state for a process. In this state, OS allocates all the required resources to a process. A process is in a ready state when it has all the resources which are being used during the execution state.

A process can come into this state only after a new state or when the CPU interrupts any process execution. 

Running

When a process is loaded with all resources then is scheduled for execution in the CPU. Once a process gets CPU its execution starts. 

Waiting

In a waiting state, a process waits for its execution. The process moves into the waiting state if it needs to wait for a resource.

Terminated or Exit

This is the final stage of the process. Once the process finishes its execution, it is terminated by the operating system. After the termination of a process, all associated parameters are also removed from the main memory.

No comments:

Post a Comment