Topic 2 Full Flashcards
CPU and Components
1) It is the brain of the computer
2) It is responsible for executing instructions and performing calculations
It has 3 main components
1) CU
2) ALU
3) Registers
What is the ALU (2)
1) It performs the arithmetic and logical operations
2) Where the actual computation happens.
What is the CU (4)
1) Manages the execution of instructions
2) Fetches instructions from the memory.
3)It then coordinates the flow of data between the CPU and other components, like memory and input/output devices, ensuring that the correct operations are performed at the right time.
4) Also, it directs the data flow and the operation of the ALU.
What are registers? (2)
1) Small, very fast circuits that temporarily store values from calculations or instructions inside the CPU.
2) Storage for intermediate data that the CPU is currently processing (e.g., during arithmetic or logic operations).
Program Counter
The Program Counter (PC) holds the memory address of the next instruction to be fetched and executed.
Current Instruction Register
The Current Instruction Register (CIR) stores the instruction that the CPU is currently decoding or executing.
Accumulator (4)
1) The Accumulator stores the results of any calculations that have taken place in the Arithmetic Logic Unit (ALU).
2) It temporarily holds data that the CPU is processing, particularly during arithmetic or logical operations.
3) After the program is executed, If needed, the result may be temporarily held in main memory (RAM) or transferred to other registers for immediate processing.
4) For long-term retention, the data can be written to secondary storage, such as a hard drive or SSD.
Primary Memory (3)
1) It is the computer’s main memory:
Primary memory serves as the central storage directly accessible to the CPU for processing data and instructions.
2) It allows direct access by the CPU:
The CPU can directly access primary memory (RAM and ROM) through the memory bus for reading and writing data.
3) It is divided into two types - RAM and ROM:
Random Access Memory (5)
1) This memory can be written to, and instructions and data can be loaded into it.
2) RAM is volatile memory: It loses its contents when the power is turned off, meaning it cannot retain data without a power supply.
3) RAM is a type of temporary memory:
It is used for the temporary storage of data and instructions that the CPU needs quick access to during active processes.
4) The RAM can be accessed a lot faster than secondary storage
5) It is high speed and RAM is smaller than secondary memory
Read Only Memory (ROM) (4)
1) You cannot delete, or edit
2) Permanent memory - All the system instructions are stored in ROM.
3) The operating system gets saved on ROM.
4) ROM is a non-volatile memory that permanently stores instructions for your computer
Cache Memory
1) Cache is a small, high-speed memory located close to or within the CPU that stores frequently accessed data and instructions.
2) It acts as a buffer between the CPU and the RAM, reducing the time the CPU has to wait to access data from slower RAM.
3) Usually has multiple levels but L1 is the smallest, fastest, and closest to CPU.
4) EG - it is a small notepad where you jot down the info you use often, so you do not have to keep looking at the bigger textbook (main memory)
Machine Cycle
1) Start at the PC:
When a computer program is opened, its data and instructions are loaded into the RAM.
In RAM, this information is organized into addresses and the corresponding binary data.
Each address holds binary data that coresponds to the operations of the program, and the program code is stored in RAM in binary format.
2) PC (Program Counter):
The Program Counter repetitively cycles through the addresses in RAM and executes the instructions.
It identifies which address in RAM contains the next instruction to execute.
The PC sends the address of the next instruction to the MAR (Memory Address Register). A register is a small piece of memory that holds a small amount of data.
3) Address Bus and Data Bus Interaction:
The address bus ( a wire that sends signals) sends the memory address from the MAR to RAM.
RAM responds by sending the corresponding data back through the data bus to the MDR (Memory Data Register).
The data bus also sends the retrieved data to the CIR (Current Instruction Register), where it is held temporarily as the instruction about to be executed.
4) Decoding the Instruction:
The Control Unit (CU) decodes the binary instruction (e.g., 1010) into a format that the ALU (Arithmetic Logic Unit) can understand.
The decoded instruction is sent to the ALU, which executes the operation.
5) ALU and Accumulator:
The ALU executes the operation represented by the instruction (e.g., an arithmetic or logical operation).
While performing calculations, the Accumulator acts as temporary storage for intermediate results.
The output of the ALU may be:
Displayed on an output device (e.g., a monitor).
Stored back in RAM for further execution.
CU’s Role:
The Control Unit (CU) oversees and coordinates the entire process, ensuring seamless communication between all components.
MAR (4)
1) Holds the memory address of where data or instructions are to be fetched from memory.
2) MAR is connected to the address bus.
3) MAR contains a memory address.
4) MAR’s sole function is to store the address in memory (RAM or ROM) that the CPU needs to access, whether for fetching instructions or data.
MDR (2)
1) MDR stores the data or instruction which has been fetched from memory.
2) MDR is connected to the data bus.
MAR and MDR relation
The MAR gives the address the data of the MDR will be read from or written to.
Secondary Memory = Secondary Storage
1) Secondary memory is computer memory that is non-volatile, persistent and not immediately accessible by a computer or processor.
2) Secondary Memory refers to all storage devices that are not part of the primary memory (RAM).
3) Secondary storage devices are used to store data and programs that are not currently being used or accessed by the computer’s CPU (Central Processing Unit).
Examples of Secondary Storage:
Hard Disk Drives (HDDs)
Solid State Drives (SSDs)
Offline Storage
Offline Storage refers specifically to storage that is not constantly connected to the computer or system.
It is secondary
Examples
1) External hard drives
2) USB drives
3) Optical discs (CDs, DVDs)
Why do we need storage?
There would be no physical place to store data memory. The RAM has space for memory but that is only meant to be for short-term memory, not long-term. The hard drive or SSD drive is where the computer stores it’s physical data. You always need at least some storage device, otherwise, the computer has no place .
Virtual Memory
1) When primary memory overloaded, data sent to virtual memory.
Primary memory (RAM) is the fast, volatile memory used by the CPU to store data that is actively being processed. However, RAM is limited in capacity, and when it becomes full (or overloaded), the operating system needs a way to handle the excess data.
2) It is Slower (hence why in terms of performance having more RAM is ideal)
3) Temporary
4) Returned to primary memory as needed
5) Stored in units called “pages”
Comparing storage
1) Smaller, Costlier, Faster
2) Larger, Cheaper, Slower