Identify the hardware requirements to run a program and the effect on code development.
What is a computer?
In the simplest possible terms, a computer is a series of switches connected together to form paths. When electricity moves along a certain path, it activates an output (such as turning on a light).
Binary can be used to represent the state of each switch, with 1 representing a closed switch (or ‘on’) and 0 representing an open switch (or ‘off’). A program is a series of binary digits which controls a sequence of switches.
Since people cannot easily understand binary instructions, assembly language provides short mnemonics for each.
What does a CPU look like?
On the inside, there are billions of transistors set across multiple layers, organised into circuits. Each of these is far too small for the human eye to see; for example, the Qualcomm Snapdragon 865 processor has 10,300,000,000 transistors in 83.54mm^2.
Components of a CPU
The CPU is separated into six main components:
- Arithmetic Logic Unit (ALU) - performs arithmetic and logical calculations
- Control Unit (CU) - directs data to the correct places
- Registers - tiny amounts of memory that can each hold a single value (like an instruction, number, letter, etc)
- Cache - extra memory for frequently used data
- Clock - a device that sends an electrical pulse to synchronise all the components
- Buses - paths which carry data between the components.