What Is Machine Cycle

What Is Machine Cycle ?

Machine Cycle

CPU Cycle

Processor Cycle

The machine cycle is  the main activity performed by the microprocessor to execute the program instructions. 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. However, the machine is part of the instruction cycle.

In computer architecture, a machine cycle refers to the basic operational steps that a central processing unit (CPU) performs to execute an instruction. These steps are typically divided into several stages, including fetch, decode, execute, and store.

The CPU is driven by internal clock cycles. It is important to understand the concept of CPU clock cycles since it is closely related to the concept of machine cycle. Depending upon microprocessor design it might take one or more clock cycles to perform one machine cycle. 

What Is Machine Cycle

Let us consider one example of the instruction cycle to understand the difference between the machine cycle and the instruction cycle. The performance of the microprocessor depends upon the CPU architecture, clock speed and the efficiency of process design in terms of number of machine cycles required to execute one part of the instruction cycle.

In the following example, the fetch part of the instruction cycle needs two machine cycles. Whereas, the execute part needs three machine cycles presuming one machine cycle needs one clock cycle.

The instruction cycle is the time taken to execute one instruction. Depending upon the complexity of the program instruction, one instruction generally needs number of machine cycles and one machine cycle might need one or more clock cycles. 

CPU Clock Speed

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

What Is Machine Cycle ?

Table Of Contents

In order to understand  what is machine cycle , we need to first understand and find answers to the the following questions :

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:

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.

How computer works , Computer Coding, Computer Program Compilation

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 .

Program Compilation

What Is Computer Program ?

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 into the main system memory ( RAM ).

The CPU starts the program execution by fetching the program instructions one by one from main memory RAM ( Random Access Memory ) . 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 to execute the program instructions.

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 :

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 .

Computer Memory Hierarchy , What Is RAM , Random Access Memory

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 and supports 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 :

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 the 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

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 processing speed of the CPU.

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.

Join The Best Seller

Computer Science Online Course

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!