In: Computer Science
At the initial stage of each instruction cycle, the processor
fetches an instruction from
memory. The processor interprets the instruction and performs the
required action.
Provide illustration of the process with a thorough explanation on
the rudimentary
instruction cycles the processor follows to execute fundamental
instructions. Discuss
how this processor interacts with the cache memory to give output
speedily.
The instruction cycle (also known as the fetch–decode–execute cycle, or simply the fetch-execute cycle) is the cycle that the central processing unit (CPU) follows from boot-up until the computer has shut down in order to process instructions. It is composed of three main stages: the fetch stage, the decode stage, and the execute stage.
Generic CPU Instruction Cycle
The generic instruction cycle for an unspecified CPU consists of the following stages:
An example of a full instruction cycle is provided by the following VAX instruction, which uses memory addresses for all three operands.
mull x, y, product
x
, y
, and product
.x
and y
from memory.x
and y
, storing the result
in a CPU register.product
.Cache memory works by taking data or instructions at certain memory addresses in RAM and copying them into the cache memory, along with a record of the original address of those instructions or data.
This results in a table containing a small number of RAM memory addresses, and copies of the instructions or data that those RAM memory address contain.
Memory Cache "Hit"
When the processor requires instructions or data from a given RAM memory address, then before retrieving them from RAM it checks to see if the cache memory contains a reference to that RAM memory address. If it does, then it reads the corresponding data or instructions from the cache memory instead of from RAM. This is known as a "cache hit". Since the cache memory is faster than RAM, and because it is located closer to the CPU, it can get and start processing the instructions and data much more quickly.