Skip to main content

Operating Systems | States of Process and Operations

A process from its creation to completion goes through various stages in order to complete the works defined on it. Each of these stages are known as states of a process.

States of a Process
  1. New

    It is a condition just before the transition from as a program in the secondary memory to a process in the main memory.

  2. Ready

    The processes which are ready on main memory and not forwarded(scheduling) into central processing system can be said in Ready state.

    There can be more one process present in ready state which will be allocated to processing unit. The order, in which each of them will get executed will depend on the nature of scheduling algorithm used. Basically scheduling algorithms are of two types:

    1. Preemptive algorithms : Scheduling algorithms with ability to suspend the process during the execution. Preemptive algorithms switches between process is also known as context switching, since PCB(context) has to be saved to resume preempted processes.
    2. Non preemptive algorithms : Scheduling algorithms which does not have the ability to suspend the process during its execution.

  3. Run

    Process which is scheduled to CPU is in Run state. A single core processor will be having one process in run state and multi-core processor may have more than one process in run state at time. CPU would be addressing focus boundary of a process in run state continuously.

  4. Block (or wait)

    (MM) Whenever there is a need of I/O during running of the process, it will switch to Block(or Wait) state and the completion of I/O will set back the process to ready state again.

  5. Termination

    Completion of execution of job defined in process turns the process to termination state, where the context get deleted and memory allocated to it will get deallocated.

  6. Suspend ready

    This state occurs when main memory is full and newly created process is of higher priority than existing processes, processes with lower priority has to be moved to the backup memory (on secondary memory). Normally decision of priority will be done by scheduler.

  7. Suspend wait (or suspend block)

    If the process which was send to backup memory(on secondary memory) was in wait or block mode for I/O operations then it is in suspend wait or suspend block state

Operations on Process
  1. CREATE : Creation of process by loading executable code of the program into main memory.
  2. SCHEDULE : Assigning process to CPU from the processes available in the main memory.
  3. EXECUTE : Running of process in the CPU.
  4. DELETE/KILLING : Deallocation of assigned memory for the creation due to completion of job.


Popular posts from this blog

Operating Systems | Scheduling Algorithms : Round Robin

| FCFS | SJF | SRTS | Round Robin | LJF | Priority Scheduling | HRRN | Round RobinFeatures : Most popular algorithm of allPractically implementableImplementable with basic data structures like queueExtremely lesser starvationOptimum efficiency can be set by controlling time quantumThe round robin algorithm will continuously switch between processes if a process in CPU (under execution) exceeds a time limit set by OS called time quantum.Flow Chart :Scheduler allocated process to for execution.CPU starts monitoring the execution time right after from allocation.If the process completes its execution before exceeding time quantum, OS forwards the process to termination state.else, the processes gets preempted once the time quantum limit exceeded and if the process finished at this moment, OS moves the process to termination state, else it moves to ready queue and iterates over the whole process listed above.Example : Consider the following table of processes and calculate complet…

Operating Systems | Scheduling Algorithms : SJF

| FCFS | SJF | SRTS | Round Robin | LJF | Priority Scheduling | HRRN | Shortest Job First(SJF)SJF algorithm schedules the shortest job(low burst time) available on main memory at the time of context switching in ready state . It can be either preemptive or non-preemptive depending on the nature of scheduler.Since the SJF select the job which is shorted among available jobs on main memory, Non-preemptive SJF algorithm will have larger waiting time if a job with longer burst time get scheduled first. In short SJF is also vulnerable to Convoy EffectTo find shortest process among min-heap would be the best data structure to be usedExample : Consider the following table of processes and calculate completion time, turn around time and waiting time using SJF algorithm with the following assumptions. No preemption.No I/O request will be there from any process.Arrival time is relative to CPU on time.Process NumberATBT103222324442View Answer

The execution of processes can be visualized …

Operating Systems | Concept of Process

Hard disk drive of the system in called primary memory and secondary memory is Random Access Memory(RAM). Either a program written in High Level Language(HLL) or a executable code generated by the sequence of works done by pre-processor, compiler and assembler, resides in secondary memory of the system. To start an execution, operating system allocates some space in the main memory, for the program to be executed and loads the program in the secondary memory to the allocated space. The piece of work which is loaded by the operating system to the main memory in order to execute program is called processEvery program loaded by operating system will create a focus boundary(or process body), a partitioned memory area where all memory requirements for the execution of program is satisfied.Variable which will not change its value through out life time of process is called static variable and variables which are globally accessible in a process known as global variable.Heap area is reserved f…