What is the relationship between process states and the machine cycle?

Operating SystemHardwareSoftware & Coding

Let us understand what a process state is.

Process States

Process states are the states in which the process is currently residing. There are basically five states of processes −

  • New − The process is about to be created in this state but not yet created. It is the program which is present in secondary memory that will be picked up by OS to create the process.

  • Ready − The process enters the ready state after the creation of a process that means the process is loaded into the main memory.

  • Running − The process is chosen by the CPU for instructions and the executions within the process and they are executed by any one of the available CPU cores.

  • Waiting − Whenever the process requests access to I/O or needs input from the user or needs access to a critical region it enters the blocked or wait state.

  • Terminated − Process is killed as well as PCB (Process Control Box) is deleted.

The process states are depicted in the diagram given below −

Machine Cycle

A machine cycle is the basic operation performed by a central processing unit (CPU) which is the main logic unit of a computer.

It consists of a sequence of three steps which is performed continuously and at a rate of millions per second while a computer is in operation.

Just like a process is in different states, in a machine cycle there are fetch, decode and execute operations.

  • Fetch − The control unit that requests instructions from main memory which is stored at a memory’s location as indicated by the program counter.

  • Decode − Received instructions are decoded in the instruction register.

  • Execute − It involves the instruction’s opcode as it specifies the CPU operation required. The program counter contains the address of the next instruction to be executed. These instructions are arranged into the instructions register and as each is executed, it increments the program counter so that the next instruction is stored in memory.

  • Store − It used to store the result and stores the next instruction that has to be executed.

The machine cycle is depicted in the diagram given below −

Published on 30-Nov-2021 12:28:45