The CPU, or Central Processing Units primary purpose is to execute instructions from software programs, performing calculations, making decisions, and managing the flow of data throughout the computer system.
Example
When you open a web browser, the CPU fetches the instructions from the browser's program, interprets them, and coordinates various components like memory, storage, and the network interface to display the webpage on your screen.
🗝️ Key points to remember:
The CPU processes instructions sequentially, one at a time.
It performs arithmetic and logical operations on data.
It controls the movement of data between different parts of the computer, like memory and storage.
It manages the execution of multiple programs simultaneously, switching between them rapidly to create the illusion of multitasking.
❌✅ Misconceptions
❌ The CPU is the only component responsible for a computer's performance.
✅ Other factors like cores, cache, clock speed, primary memory, storage speed, and graphics processing also play a significant role.
❌ The CPU does not "think" or "understand" like a human brain.
✅ It simply follows instructions encoded in software programs.
The Fetch-Decode-Execute (FDE) cycle is the fundamental process by which a CPU carries out instructions stored in memory. It's a continuous cycle that repeats for each instruction, allowing the CPU to perform complex tasks by breaking them down into smaller, manageable steps.
The Three Stages
Fetch:
The CPU fetches the next instruction from memory, using the address stored in the Program Counter (PC) register.
The fetched instruction is placed in the Instruction Register (IR).
The PC is incremented to point to the next instruction in memory.
Decode:
The CPU decodes the instruction in the IR, determining the operation to be performed and identifying any required data or memory addresses.
Execute:
The CPU carries out the decoded instruction. This may involve performing calculations, manipulating data, or controlling other hardware components.
The result of the execution may be stored in registers or memory.
🗝️ Key points to remember:
The FDE cycle is the core operational mechanism of a CPU.
Each instruction goes through these three stages sequentially.
The cycle repeats continuously until the program terminates or encounters a halt instruction.
Specialised registers within the CPU, such as the PC and IR, are essential for managing the FDE cycle.
❌✅ Misconceptions
❌ The FDE cycle is a single, instantaneous operation.
✅ It's a sequence of steps performed at high speed.
Arithmetic Logic Unit (ALU): Performs arithmetic operations (like addition and subtraction) and logical operations (like AND, OR, NOT) on data.
Control Unit (CU): Manages and coordinates the activities of all other components within the CPU, ensuring instructions are executed in the correct sequence.
Registers: Small, high-speed storage locations within the CPU that temporarily hold data and instructions during processing.
Example
During the execution of an instruction to add two numbers, the ALU would perform the addition, while the CU would ensure the correct data is fetched from memory and the result is stored back in the appropriate location. Registers would hold the numbers being added and the final result
🗝️ Key points to remember:
Each CPU component has a specific role in the overall functioning of the CPU.
The interaction and coordination between these components is crucial for efficient processing of instructions.
The speed and capacity of these components, along with other factors like clock speed and number of cores, influence the overall performance of the CPU.
❌✅ Misconceptions
❌ The CPU is a single entity.
✅ It's a complex system comprising various interconnected components working together.
❌ Registers are the same as main memory (RAM).
✅ Registers are much faster but have limited storage capacity, while RAM is larger but slower.
❌ Cache memory is a replacement for RAM.
✅ It's a supplementary, high-speed storage area that helps improve performance by reducing the need to access slower main memory frequently.
The Von Neumann architecture is a fundamental design model for modern computers. It describes a computer system where both data and instructions are stored in the same memory, and a single shared bus is used for fetching instructions and transferring data.
Key Principles
Stored-program Concept: Programs are represented as data and stored in memory, allowing for flexibility and reprogrammability.
Sequential Execution: Instructions are fetched and executed one at a time in a linear order.
Shared Memory: Both data and instructions reside in the same memory unit, accessible by the CPU.
These registers play crucial roles in the fetch-decode-execute cycle and overall CPU operation:
MAR (Memory Address Register): Holds the memory address of the current data or instruction that the CPU needs to access.
MDR (Memory Data Register): Temporarily stores the data or instruction fetched from memory or the data to be written to memory.
Program Counter (PC): Holds the memory address of the next instruction to be executed.
Accumulator: A general-purpose register often used for storing intermediate results of calculations or data manipulations within the ALU.
❌✅ Misconceptions
❌ All registers are the same
✅ There are various types of registers, each serving a specific purpose.
Definition: Clock speed, measured in Hertz (Hz), represents the number of cycles a CPU can execute per second. Each cycle involves fetching, decoding, and executing an instruction.
Impact on Performance: Higher clock speed generally translates to faster performance. More cycles per second mean more instructions can be processed in a given time, leading to quicker task completion.
However, it's not the sole determinant of performance. The complexity of instructions and the CPU's architecture also play a role. Some instructions might take multiple cycles to complete, regardless of clock speed.
Real-world Analogy: Imagine a factory assembly line. A higher clock speed is like speeding up the conveyor belt.
Every C.P.U. has a clock that controls the speed at which it completed F.D.E. cycles.
For each pulse/tick of the clock an F.D.E. cycle is completed.
Clock speed is measured in hertz and one FDE cycle per second would be 1 hertz.
Hz 1 F.D.E. instruction cycle.
Khz 1000 F.D.E. instruction cycles per second (1 thousand).
Mhz 100,000 F.D.E. instruction cycles per second (1 million).
Ghz 1,000,000,000 F.D.E. instruction cycles per second (1 billion).
Definition: Cache is a small, high-speed memory located within the CPU. It stores frequently accessed data and instructions, reducing the need to fetch them from the slower main memory (RAM).
Impact on Performance: Larger cache size improves performance. More data and instructions can be stored in the cache, leading to faster access and reduced latency. The CPU spends less time waiting for data from RAM, enabling it to execute instructions more efficiently.
Real-world Analogy: Think of cache as a toolbox near a workbench. A larger toolbox means more frequently used tools are within easy reach, reducing the time spent searching for them in a distant storage room.
Cache predicts and preloads the most frequently used data and instructions needed from RAM.
It ensures the C.P.U. always has data to process, it is never idle and more efficient.
Definition: Cores are independent processing units within a CPU. Each core can execute instructions simultaneously, enabling parallel processing.
Impact on Performance: More cores generally lead to better multitasking and improved performance in applications designed for parallel processing. Tasks can be divided among cores, allowing them to be completed concurrently.
However, not all software can utilize multiple cores effectively. Single-threaded applications might not see a significant performance boost from additional cores.
Real-world Analogy: Imagine a team of workers tackling a project. More workers mean more tasks can be handled simultaneously, leading to faster completion, provided the tasks can be divided effectively.
Each core is its own C.P.U.
Each core is equipped with its own Control Unit, Arithmetic Logic Unit and set of Registers.
4 cores at 3Ghz = approx 12 billion F.D.E. cycles a second.
Programs that have been created to use multiple cores will run faster.
The computer needs less power because it can turn off some sections if they aren't needed.
❌✅ Misconceptions
❌ More cache is always better.
✅ While larger cache generally improves performance, there's a point of diminishing returns.
❌ More cores automatically mean better performance.
✅ The effectiveness of multiple cores depends on the software's ability to utilize them. Single-core applications will not see any benefit from additional cores.
Embedded systems are designed to perform a specific function or set of functions, often within a larger device or system. They are typically dedicated to a single task and are not easily reprogrammed.
Example: A microwave oven has an embedded system to control its cooking functions.
🗝️ Key points to remember:
Embedded systems are task-specific.
They are often part of a larger system.
They are not easily reprogrammable.
❌✅ Misconceptions
❌ Embedded systems are always small and simple.
✅ Some can be complex and control multiple functions.
Real-time operation: Many embedded systems need to respond to events in the real world within a specific timeframe.
Limited resources: Embedded systems often have limited processing power, memory, and storage.
Low power consumption: They are often designed to operate on batteries or other low-power sources.
Reliability: They need to be able to operate for long periods without failure.
Cost-effectiveness: They need to be designed and manufactured at a low cost.
Minimal user interface: Many embedded systems have limited or no user interface. They may interact with the user through simple indicators (e.g., LEDs) or buttons, or they may operate autonomously.
Examples:
A pacemaker: has an embedded system that needs to operate reliably for many years, with low power consumption.
Washing Machine: An embedded system controls the washing machine's various cycles, water temperature, and spin speed. It might also include features such as delayed start and error detection.
Microwave Oven: An embedded system controls the microwave's cooking time, power levels, and various preset cooking options.
Smart Thermostat: A more advanced embedded system with connectivity, allowing users to control and monitor their home's temperature remotely through a smartphone app or voice commands.
Digital Alarm Clock: A simple embedded system displaying time, setting alarms, and perhaps including features like radio or snooze functions.
Television Remote Control: An embedded system sends signals to the television to control various functions such as power, volume, channel selection, and input source.
🗝️ Key points to remember:
Embedded systems have constraints on resources and power consumption.
They need to be reliable and cost-effective.
❌✅ Misconceptions
❌ Embedded systems are always slow.
✅ Some can be very powerful and perform complex tasks.
❌ Embedded systems are not connected to the internet.
✅ Some can be connected and interact with other devices or systems.