process states

Process Model:
1. Process is considered as a program in execution.
2. Process Model is a mechanism for describing and communicating the current or intended future state of a process.

Image result for 5 state process model

I) New:
 It is an initial state.
 A process has been created but has not yet been admitted to the pool of executable processes.
II) Ready:
 In this state, the processes are waiting to have the processor allocated to them by the operating system so that they can run.
 Process may come into this state after New State or while running it by but interrupted by the scheduler to assign CPU to some other process.
III) Running:
 Once the process has been assigned to a processor by the OS scheduler, the process state is set to running and the processor executes its instructions.
IV) Blocked:
 A process that cannot execute until a specified event such as an IO completion occurs.
V) Exit:
 Once the process finishes its execution, or it is terminated by the operating system, it is moved to the terminated state where it waits to be removed from main memory.

Contributor's Info

Created:
0Comment
Process States

Processes can be any of the following states :

  • New - The process is being created.
  • Ready - The process is waiting to be assigned to a processor.
  • Running - Instructions are being executed.
  • Waiting - The process is waiting for some event to occur(such as an I/O completion or reception of a signal).
  • Terminated - The process has finished execution.

Process State

Contributor's Info

Created:
0Comment
Process and Process State Model

Process: Generally, a process is  program in execution. A process includes current activity, contents of the processor’s registers, process stack, and data section. A process may include a heap. Heap is a memory that dynamically allocated during process runtime. Abstraction view of a process is given below:

     7.jpg           

 

There is two types of processes:
(i) System process: These process can not be preempted and executed in privileged mode.

(ii) User process: These process can be preempted and executed in user mode.

 

Every process has three parts first is executable program or code section, second is data section and third is context section. Context section of a process contains stack and process control information which managed by operating system. Code and data section of a program are called as user address space.
       8.jpg         

 

Process Control Block(PCB): Each process has its own process(or task) control block(PCB).

 

      9.jpg

We can differentiate processes using process id. Process state defines current state of process; process state can be new, ready, running, waiting etc. Program counter contains address of next instruction to be executed. I/O status information includes list of allocated open devices, list of allocated open files etc. Generally, every PCB has three grouped informations:

  • Process identification data contains has numeric identifier, parent identifier, user identifier etc.

  • Process control information contains process state information, links to other process memory privileges, scheduling etc.

  • CPU state information contains stack pointers, user visible registers, control and status registers etc.

       

Process  State Models

There are various types of propess state model. Process state defines current state of a process. The process states are new, ready, running, waiting, suspended waiting, terminated etc.
 

  1. New state: The process is being created.

  2. Ready state: The process is ready to run, but waiting to be assigned a processor.

  3. Running state: Program is running in other words instructions are being executed.

  4. Waiting state: Process preempted and switched from running state to waiting state because of process is waiting for some event to occur such as I/O completion.

  5. Terminated state: This state is final state, when process is completed or finished execution it moves from running state to terminated state.  

Two more states are suspended ready and suspended blocked. A process moves from ready state to suspended ready due to more priority for other processes. A process moves from waiting state to suspended blocked state due to process might be consuming more memory.

 

Note that ready state, running state and waiting state are always resides in main memory and new state, suspended ready and suspended blocked state resides in secondary memory.   

There are four types of process model:

(i) Two state process model:

 11.PNG

 

(ii) Five state process model:

  12.PNG

(iii) Six state process model:

   16.PNG

(iv) Seven state process model:

    17.PNG

 

Where R = Running, W = Waiting, T = Terminated, SB = Suspended block, and SR = Suspended ready state. Preemption, dispatch, schedule , suspend, created, active, terminated etc. are actions that performed by operating system.

 

Process Transitions:

  • Transition from new state to ready state occurs when a process is created.

  • Transition from ready state to running state occurs when CPU decides(using process scheduling algorithm) which process will run next.

  • Transition from running state to ready state occurs when process preempted.

  • Transition from running state to waiting state occurs when process required I/O event.

  • Transition from waiting state to ready state occurs when I/O event has completed.

  • Transition from running state to terminated state occurs if process has finished its execution.

 

Types of Process: There is three type of process:

  1. CPU - Bound: Process needs more service by CPU than I/O service.

  2. I/O - Bound: Process needs more I/O service than CPU service.

  3. Interactive: Process spends more time in waiting queue than CPU burst time.

 

Contributor's Info

Created: Edited:
0Comment