You are on page 1of 6

FETCH EXECUTE CYCLE

A computer program is made up of sets of instructions which are


encoded using the binary numbering system. The fetch – decode –
execute cycle is the order of steps that the Central Processing Unit
(CPU) uses to follow instructions. The fetch execute cycle was first
proposed by John von Neumann who is famous for the Von Neumann
architecture, the framework which is being followed by most computers
today.

The CPU is the brain of the computer and known as the processor. It is
responsible for implementing a sequence of commands called a
program. A program takes inputs, processes them and outputs
results. CPUs are found everywhere, like in mobile phones, computer
tablets and washing machines.

A CPU has the following components:

 Control Unit – controls all parts of the computer system. It


manages the four basic operations of the Fetch Execute Cycle as
follows:
1. Fetch – gets the next program command from the computer’s
memory
2. Decode – deciphers what the program is telling the computer to
do
3. Execute – carries out the requested action
4. Store – saves the results to a Register or Memory
 Arithmetic Logic Unit (ALU) – performs arithmetic and logical
operations
 Register – saves the most frequently used instructions and data
The primary task of the CPU is to execute programs using the fetch –
decode – execute cycle. This is also called as the instruction cycle. The
cycle begins as soon as the computer is turned on and ends when the
computer is shut down.

In plain CPUs the fetch execute cycle is carried out progressively, each
instruction is being handled before the succeeding one is initiated. In
modern CPUs the fetch execute cycle is executed simultaneously, in
parallel via an instruction pipeline, which means the next command
starts being executed before the previous command has completed. This
is made possible since the cycle has been broken up into separate steps.

To run a program, the program code is copied from secondary storage


into the primary memory. The CPU’s program counter is specified to
the memory location where the first command in the program has been
saved and execution starts. The program starts running. A program
counter keeps track of the memory address of the command to be
executed next.

In a program, each machine code command occupies a space in the main


memory. These memory locations each have a specific memory
address. The program counter saves the address of each command and
instructs the CPU in what sequence they should be executed.

When a program is being carried out, the CPU implements the fetch –
decode – execute cycle, which recurs over and over again until arriving
at the STOP instruction.

Here’s a summary of the fetch – decode – execute cycle:

1. The processor reviews the program counter to see which command


to execute next.
2. The program counter gives an address value in the memory of
where the next command is.
3. The processor fetches the command value from the memory
location.
4. Once the command has been fetched, it needs to be decoded and
executed. For example, this could include taking one value, putting
it into the Arithmetic Logic Unit (ALU), then taking a different
value from a register and adding the two together.
5. Once this has been completed, the processor returns to the program
counter to find the next command.
6. This cycle is replicated until the program stops.

The Execute Cycle is the only step useful to the end user, everything
else is required to make the execute cycle happen, as it performs the
function of the command. The ALU is utilised if the command involves
arithmetic or logical operations.

Operating System - Overview


An Operating System (OS) is an interface between a computer user and computer
hardware. An operating system is a software which performs all the basic tasks like file
management, memory management, process management, handling input and output,
and controlling peripheral devices such as disk drives and printers.

Some popular Operating Systems include Linux, Windows, OS X, VMS, OS/400, AIX,
z/OS, etc.

Definition
An operating system is a program that acts as an interface between the user and the
computer hardware and controls the execution of all kinds of programs.
Following are some of important functions of an operating System.

 Memory Management

 Processor Management

 Device Management

 File Management

 Security

 Control over system performance

 Job accounting

 Error detecting aids

 Coordination between other software and users

Memory Management
Memory management refers to management of Primary Memory or Main Memory. Main
memory is a large array of words or bytes where each word or byte has its own
address.

Main memory provides a fast storage that can be accessed directly by the CPU. For a
program to be executed, it must in the main memory. An Operating System does the
following activities for memory management −
 Keeps tracks of primary memory, i.e., what part of it are in use by whom, what
part are not in use.

 In multiprogramming, the OS decides which process will get memory when and
how much.

 Allocates the memory when a process requests it to do so.

 De-allocates the memory when a process no longer needs it or has been


terminated.

Processor Management
In multiprogramming environment, the OS decides which process gets the processor
when and for how much time. This function is called process scheduling. An
Operating System does the following activities for processor management −

 Keeps tracks of processor and status of process. The program responsible for
this task is known as traffic controller.

 Allocates the processor (CPU) to a process.

 De-allocates processor when a process is no longer required.

Device Management
An Operating System manages device communication via their respective drivers. It
does the following activities for device management −

 Keeps tracks of all devices. Program responsible for this task is known as the
I/O controller.

 Decides which process gets the device when and for how much time.

 Allocates the device in the efficient way.

 De-allocates devices.

File Management
A file system is normally organized into directories for easy navigation and usage.
These directories may contain files and other directions.

An Operating System does the following activities for file management −


 Keeps track of information, location, uses, status etc. The collective facilities are
often known as file system.

 Decides who gets the resources.

 Allocates the resources.

 De-allocates the resources.

Other Important Activities


Following are some of the important activities that an Operating System performs −

 Security − By means of password and similar other techniques, it prevents


unauthorized access to programs and data.

 Control over system performance − Recording delays between request for a


service and response from the system.

 Job accounting − Keeping track of time and resources used by various jobs
and users.

 Error detecting aids − Production of dumps, traces, error messages, and other
debugging and error detecting aids.

 Coordination between other softwares and users − Coordination and


assignment of compilers, interpreters, assemblers and other software to the
various users of the computer systems.

You might also like