Processor and Computer Hardware
The Processor
The processor refers to any electronic component capable of performing mathematical and logical operations. While the CPU (central processing unit) is the primary general purpose processor responsible for managing the system, other specialised processors utilise the same fundamental components, but are implemented and produced differently to optimise for specific workloads.
The processor is responsible for processing and executing program instructions as per the fetch-decode-execute (FDE) cycle.
- Fetch: The address of the next instruction is copied from the program counter to the memory address register. The fetched instruction is copied to the memory data register, and the program counter is incremented by 1. The contents of the memory data register are copied to the current instruction register.
- Decode: The instruction held in the current instruction register is decoded by the control unit, then split into opcode and operand. The opcode determines the type of instruction, and the operand holds either the address of the data to be used (copied to the memory address register) or the actual data to be used. Data is passed to the memory data register.
- Execute: The instruction is carried out.
Control Unit
The control unit is responsible for directing the flow of data between different components of the processor. It is responsible for all three parts of the fetch-decode-execute cycle.
Buses
A bus is a set of parallel wires connecting two or more components of a computer. There are three main buses, collectively known as the system bus:
- Address bus: The bus along which an address of RAM is sent.
- Data bus: The bus along which data is sent.
- Control bus: The bus along which a control signal (e.g. read and write) is sent.
Arithmetic Logic Unit
The arithmetic logic unit (ALU) is responsible for performing arithmetic, such as adding and subtracting, as well as multiplication and division by executing bit shifts, and logical operations on data with operators like AND, OR, NOT, and XOR. Operations are performed on, and results are stored in, the accumulator.
Registers
Registers are super-fast, low-capacity primary memory devices located inside the processor. Each register has a dedicated purpose.
- Program counter (PC): Holds the address of the next instruction to be executed. Can be modified by a branch instruction, and is otherwise incremented on every FDE cycle.
- Current instruction register (CIR): Holds the current instruction executed.
- Memory address register (MAR): Holds the address of the memory location from/to which data has to be read from/written.
- Memory data register (MDR): Temporarily holds data read from a memory address or that needs to be written to one. (A.k.a. the memory buffer register.
Cache Memory
Cache is a small amount of very fast memory located inside the processor. It stores frequently accessed instructions and data, so the processor does not have to fetch it from the RAM so often, which is located much further from the processor than cache. Reduces data transmission times thus result in greater processor performance. However, instructions and data in the cache could become outdated, harming data integrity.
Furthermore, cache tends to be low in capacity - if it's too large, more time is spent searching the cache for the desired data, reducing processor performance. For this reason, processors tend to have levels of cache. E.g. in a CPU, there is level 1 cache (low capacity, ~2-64KB) and level 2 cache (higher, ~0.256-2MB).
Clock speed
The clock speed dictates the number of FDE cycles that occur per second, affecting the speed of instruction execution. This number is so vast, it is measured in MHz (million hertz) or GHz (billion hertz). The larger this number, the more cycles, but the more power drawn to do so, resulting in more heat being generated.
Pipelining
Pipelining involves the fetching and decoding of instructions while another is executing. This uses components of the CPU that would otherwise be idle during the execution of a single instruction. Thus, three FDE cycles can be running at the same time. Take instructions A to F for example in an instruction pipeline:
| Fetch | Decode | Execute |
| A | ||
| B | A | |
| C | B | A |
| D | C | B |
| E | D | C |
| F | E | D |
Cores
A core is an independent processing unit within a processor that contains all of the above components and techniques. Multiple cores are connected in parallel in a circuit and can communicate with each other. Since they are otherwise independent of each other, they can execute instructions simultaneously. However, the more cores there are, the more power is drawn, causing heat to be generated.
Computer Architecture
Von-Neumann
The Von-Neumann architecture involves a shared system bus for data and instructions, shared memory storage for data and instructions, an ALU, CU, and registers. Mainly used in general purpose computers.
Harvard Architecture
The Harvard architecture involves separate system buses leading to two separate memory storages for data and instructions, an ALU, CU, and registers. Mainly used in embedded systems.
Types of Processor
CISC Processor
Complex instruction set computer (CISC) processors have large numbers of instructions that perform complicated tasks. Compilers for CISC processors are thus simple, as machine code becomes short, simultaneously also requiring less RAM to run. However, the complexity of CISC processor circuits makes their production far more expensive. Furthermore, only about 20% of CISC processor instructions are actually used in compilation, so 80% of them are redundant, unnecessarily increasing cost. Furthermore, each CISC processor instruction doesn't have a fixed execution time, as they can be the equivalent of RISC processor instructions. This makes CISC processor execution times less reliable.
RISC Processor
Reduced instruction set computer (RISC) processors have far fewer instructions that are much simpler. An advantage is that the processors' circuits are far simpler, so they are cheaper to manufacture. Furthermore, each instruction takes the same amount of time to execute. However, compilers are far more complex due to more instructions being required for the same task, which also results in higher memory usage.
Co-Processor
A co-processor is an extra processor that supplements the functions of the primary processor. It's not a general purpose processor, but can perform tasks like floating-point arithmetic and graphics processing.
Graphics Processing Unit (GPU)
The GPU is a co-processor specialised for manipulating computer graphics, crypto mining, password cracking, etc. It has a massive parallel architecture with thousands of smaller, more efficient cores designed for handling multiple tasks simultaneously. It is capable of performing SIMD (single instruction, multiple data), where a single instruction can be carried out on vast numbers of data.
No comments to display
No comments to display