What Is Machine Cycle

What Is Machine Cycle ?

Instruction Cycle | CPU Cycle | Processor Cycle

The machine cycle is  the main activity performed by the microprocessor to execute the program instruction. The Machine cycle in the context of CPU ( Central Processing Unit ) is also alternately referred to as Instruction cycle or CPU cycle Or processor cycle .

In this article we will discuss in detail what is machine cycle , the difference between instruction cycle and machine cycle , how CPU executes program instructions and the various steps involved for a one machine cycle.

What Is Machine Cycle ?

Table Of Contents

In order to understand the What Is A machine cycle , we need to understand and find answers to the the following questions :

  • What Is A Microprocessor ( CPU ) ?
  • What Is Computer Program ?
  • What Is A Program Instruction ?
  • How CPU Executes Program Instructions ?
  • What Is Machine Cycle ?
  • What Is Instruction Cycle ?
  • CPU Speed And Instruction Cycle

What Is A Microprocessor ( CPU ) ?

The CPU functions like a brain of the computer system . The CPU controls the various system components and the external devises attached to the computer system. The CPU also controls all the activities performed by the computer system.

The CPU is also responsible to execute the program . The CPU is also alternately referred to as microprocessor or simply a processor . The CPU internally consist of three main units :

  • Control Unit ( CU ) .
  • Arithmetic Logic Unit ( ALU ).
  • Memory Unit ( MU ) .
computer C P U , Instruction Cycle , Machine Cycle
computer C P U

The Control unit ( CU )  is mainly responsible to control the activities of the computer system by sending control signals to the various system components . The control unit also decodes the program instructions to perform the desired operation.

The Arithmetic logic Unit ( ALU ) performs all the arithmetic and logical operations necessary to execute the program instructions.

The CPU memory unit consist of  high speed memory registers to store the frequently used data and instructions in order to optimize the CPU processing speed.  

What Is Machine Cycle ?

What Is Computer Program ?

The computer system consist of both hardware and software components . The computer system needs to be directed by a set of program instructions .

The software is nothing but a computer program which directs the computer hardware to perform the desired operations. The computer program consist of group of program statements. Each program statement performs a specific task .

The Computer program can be written in any programming language . However , the computer programs are generally written in a high level programming language which is a very easy to understand for programmers.

Machine Cycle ,Computer Coding, Computer Program Compilation , Java Programming Basics

However , the computer system can execute only machine code instructions in binary . The binary number system makes use of only two numbers 0 and 1 to represent any number .

Why Computer Use Binary Number System ?

And therefore , the high level programs are converted to machine executable code by a process called program compilation .

What Is Machine Cycle ?

How CPU Executes Program Instructions ?

The computer user initiates the program execution to perform the desired job on the system. The operating system then loads the executable copy of the program and corresponding data in to the main system memory ( RAM ).

The CPU starts the program execution by fetching the program instructions one by one from main memory RAM. The CPU executes the program instruction by repetitively performing the machine cycle .

The machine cycle is the main activity of the microprocessor . The machine cycle enables the CPU to execute the program instructions .

Central Processing Unit CPU
How CPU Executes Program Instructions

What Is Machine Cycle ?

The machine cycle is the main activity of the CPU to execute the program Instructions. The CPU continuously performs the machine cycle necessary for program execution.

The machine cycle consist of sequence of four steps which includes Fetch , Decode , Execute and Store .The processor continuously and repetitively performs all these four steps sequentially in the machine-cycle . The machine-cycle steps include :

  • Fetch The Program Instruction .
  • Decode The Program Instruction.
  • Execute The Program Instruction.
  • Store The Result .
Arithmetic Logic Unit , Central Processing Unit , What IS CPU , Instruction Cycle

What Is Machine Cycle ?

Machine Cycle Step - 1

Fetch The Program Instruction

The CPU initiates the program execution by fetching the program instruction and the corresponding data from the main system memory RAM .

The CPU processing speed is very high . Whereas the data access speed of the main memory cannot match the execution speed of the CPU .

And therefore , the computer system makes use of different types of memory such as RAM , Cache L1 , L2 , L3 and the memory registers. These memories are placed in hierarchical order  to optimize the CPU performance .

Machine Cycle Step - 2

Decode The Program Instruction

The control unit decodes the program instruction as per the CPU’s own architecture . Each processor chip implements a set of binary commands that is referred as Instruction Set Architecture ( ISA ).

The control unit  decodes and translates  the program machine code  instructions. The control unit then generates the necessary  signals  for  the Arithmetic Logic Unit ( ALU )  and  for other units . 

Instruction Set Architecture
Microprocessor Instruction Set Architecture

Machine Cycle Step - 3

Execute The Program Instruction

After decoding the instruction , the next step for the CPU is to execute the desired operation on the operand ( Input Data )  . Each program instruction has two parts :

  • OP Code ( Operation Code ).
  • Operand .

The Arithmetic Logic Unit ( ALU ) operates on the operand as per the operation code ( OP Code ) . The CPU operates on the data as per the its ISA ( Instruction Set Architecture ) for a given OP Code.

This OP Code tells the CPU which operations are to be performed on the Operand ( input data ).

OP Code And Operand
Machine Instruction

Machine Cycle Step - 4

Store The Result

Once the ALU operates on the data , the processed data is then sent and stored back into the main memory RAM ( Random Access Memory ) .

This stored data in the RAM can either be sent to any output device such as monitor Or printer Or it can be sent to any permanent storage device for future use.

What Is Instruction Cycle ?

The instruction cycle is the process executed by the computer CPU to execute one single program instruction.

The Processor starts instruction cycle by fetching the instruction , decoding the instruction ,  then performing the desired operation and finally storing the result in the memory .

The machine cycle is the part of instruction cycle . And therefore , depending upon the type of the instruction , a single instruction might need one or more machine cycles to get executed by the CPU.

The minimum number of machine cycles required is one and the maximum number of machine cycles is four to execute one instruction.

Instruction Cycle

Instruction Cycle

Step By Step

The microprocessor has to perform sequence of operations to execute a single instruction. This process is called instruction cycle. The instruction cycle consist of following steps :

Processor Cycle
  1. Read an Instruction
  2. Decode the instruction
  3. Find the address of operand
  4. Retrieve an operand
  5. Perform the desired operation
  6. Find the address of destination memory.
  7. Store the result into the destination memory.

How CPU Performs Instruction Cycle ?

The Clock Speed And Instruction Cycle

The CPU provides the processing power to the computer system .The microprocessor ( CPU ) speed is determined by the clock cycle speed. The CPU is driven by a stream of clock pulses . The clock cycle is the amount of time between two pulses of an oscillator.

The clock speed is an important index of the CPU’s  processing power .The higher number of clock pulses per second, the faster the computer processor will be able to process the information.

The clock speed is measured in Hz, generally either in Megahertz ( MHz ) or Gigahertz ( GHz ). For example, a 2 GHz processor performs 2,000,000,000 clock cycles per second.

Clock Speed And Instruction Cycle

The microprocessors ( CPU )  can execute one or more instructions per clock cycle, depending on the type of processor. The early first generation of processors were slower processors which can only execute one instruction per clock cycle.

However , the latest faster generation of advanced microprocessors can execute multiple instructions per clock cycle which significantly improves  the CPU processing speed.

Generally for most processors , it takes twelve clock cycles for one machine cycle to complete . And one instruction cycle might take one or maximum four machine cycles to execute the one instruction.

Learn Computer Science And Programming Fundamentals

Online Course - Udemy

This is the most comprehensive  and unique  Computer Science  And Programming Fundamentals course Online which will give you in depth understanding of most important fundamental concepts in computer science And Programming .

Sharing is caring!

Don`t copy text!