ComputingRevision.net

Central Processing Unit (CPU)

Brain and CPU

The Purpose of the CPU

The CPU can be thought of as the computer's brain. It:

  • Receives instructions and data from input and storage devices
  • Controls everything the computer does
  • Sends the results of processing to output and storage devices

All computing devices have a CPU.

The Fetch–Decode–Execute Cycle

  • FDE Cycle - Fetch

    Fetch

    The CPU fetches an instruction from the computer's RAM (like getting a command from a to-do list).

  • FDE Cycle - Decode

    Decode

    The instruction is then passed to decode.

    The CPU decodes the instruction. This means it figures out what the instruction is telling it to do and converts it into instructions which can be carried-out.

  • FDE Cycle - Execute

    Execute

    The decoded instructions are passed to execute.

    The CPU executes the instruction – it does what the instruction says.

  • FDE Cycle - Repeat

    Repeat

    The processed data is now passed back to RAM to be stored.

    Because this is a cycle, it starts all over again.

    Remember, CPUs are super-fast, and they can do billions of these cycles every second!

x/x

Factors Affecting CPU Performance

Clock Speed

Clock
  • CPUs can only perform one instruction at a time
  • On each tick of its clock, it performs one Fetch-Decode-Execute cycle
  • Clock speed is measured in cycles per second (hertz)
  • Modern CPUs can execute billions of instructions per second (gigahertz)
  • Hertz is shortened to Hz, megahertz to MHz, and gigahertz to GHz.

Number of Cores

Apple core
  • A CPU core can be thought of as an extra processor within the CPU
  • Each core has its own fetch-decode-execute cycle which runs at the same time as the other cores
  • This lets the whole CPU process more than one instruction at a time
  • Dual core means two cores, quad core means four cores, and octa core means eight cores

CPU Cache

Bag of Money
  • An area of super-fast memory on the CPU
  • Frequently used instructions are kept in the cache — it’s quicker than getting them from RAM
  • Cache memory is small and very expensive
  • Do not confuse CPU cache with web browser cache. CPU cache only stores data for the CPU, browser cache stores web page data

Calculating Instructions Per Second

To calculate how many instructions per second a CPU can perform, we multiply the clock speed by the number of cores.

Example: A 4GHz CPU with two cores will execute 8 billion instructions per second
(4GHz is 4 billion instructions, multiplied by 2 cores, equals 8 billion instructions per second).


Quick Quiz

Click the purple circle to select your answer

Which cycle describes how a CPU processes instructions?

Start-Run-Stop
Fetch-Decode-Execute
Read-Write-Repeat
Load-Execute-Save