Com 314 Handout
Com 314 Handout
Moore’s Law: The number of transistors on a chip doubles every 18-24 months.
Miniaturization: Chips have become smaller and more powerful.
Emergence of GPUs: Specialized for parallel processing tasks.
Clock Speed: Measured in GHz, determines how fast a processor executes instructions.
Throughput: The number of instructions executed per unit time.
Latency: Time taken to complete a single task.
Benchmarking: Testing systems under specific workloads.
CHAPTER TWO
COMPUTER SYSTEM ARCHITECTURE
A computer system consists of functional units that work together to process data and execute
tasks.
Input Unit: Accepts data from the external environment and converts it into a format the
computer can process (e.g., keyboard, mouse).
Output Unit: Converts processed data into a human-readable format (e.g., monitor,
printer).
Performs arithmetic operations (e.g., addition, subtraction) and logical operations (e.g.,
AND, OR).
Acts as the brain of computation.
5️⃣ Registers:
The fetch and execute cycle describes how the CPU processes instructions.
1️⃣ Fetch: The CPU fetches the next instruction from memory.
2️⃣ Decode: The control unit interprets the instruction.
3️⃣ Execute: The instruction is executed by the ALU or relevant unit.
4️⃣ Store: The result is written back to memory or a register.
Performance Merits:
CHAPTER THREE
COMPUTER ARITHEMETIC AND OPERATORS
Computers operate using binary numbers (0s and 1s) as they rely on electronic signals (on/off
states). Other number systems include decimal, octal, and hexadecimal.
Example: 4510
Binary to Decimal: Multiply each bit by 2n (where n is its position from the right,
starting at 0).
Decimal to Binary: Divide the number by 2 and record the remainders.
Similar to decimal subtraction, but borrows occur from the next higher bit.
Example:
Example:
Adding 510 and −310:
5=000001012
−3=111111012 (Two’s complement of 3).
Sum: 000000102 =210.
1. Sign Bit (1 bit): Indicates the sign (0 for positive, 1 for negative).
2. Exponent (8 bits): Stores the exponent in a biased form.
3. Mantissa (23 bits): Represents the significant digits.
Example:
3.2510 in IEEE 754 format:
The Control Unit (CU) is a component of the CPU responsible for directing and coordinating
the activities of the computer. It ensures the correct execution of instructions by managing the
flow of data between the CPU, memory, and I/O devices.
The data path refers to the flow of data within the CPU. It includes:
Example:
For an addition operation, the data path involves fetching operands from registers, sending them
to the ALU, performing the addition, and storing the result back.
4.5 Explain the CPU Instruction Cycle
The instruction cycle is the sequence of steps the CPU follows to execute an instruction.
1. Fetch:
The control unit retrieves the next instruction from memory, using the Program Counter
(PC).
2️⃣ Decode:
The control unit interprets the instruction to determine the operation and the operands.
3️⃣ Execute:
The ALU or another component performs the operation.
4️⃣ Store:
The result is written back to a register or memory.
An instruction set is the collection of commands or instructions that a CPU can execute. It
serves as the interface between the software (programs) and the hardware (CPU).
Components of an Instruction:
1. Opcode (Operation Code): Specifies the operation to be performed (e.g., ADD, SUB,
MOV).
2. Operands: Specifies the data to be operated on (e.g., registers, memory locations)
3. Addressing Mode: Specifies how the operand is accessed (e.g., direct, indirect).
4. Input/Output Instructions:
An instruction set operates by breaking down high-level tasks into smaller operations executable
by the CPU.
Memory Locations:
Memory is divided into locations identified by unique addresses. Each location can store a fixed
amount of data (e.g., 1 byte).
Addressing Modes:
Example: LOAD R1, 100 (Load data from memory address 100 to R1).
Example: LOAD R1, (R2) (Load data from the address stored in R2).
Example: LOAD R1, 100(R2) (Load data from address 100 + contents of R2).
4. Input/Output Instructions:
1️⃣ Registers:
Memory Structures:
Backing Store:
Refers to secondary storage devices like hard drives (HDDs) or solid-state drives
(SSDs).
Used to store data that is not actively being used.
Cache Memory:
Memory mapping refers to how data in the main memory is mapped to the cache for faster
access.
Extends the size of physical memory by using disk space as additional memory.
Allows programs to use more memory than physically available.
Implemented using paging or segmentation.
One-Level Store:
Combines main memory and secondary storage into a single addressable memory space.
Abstracts the difference between fast (main) and slow (secondary) storage.
1. Paging:
2. Segmentation:
Divides memory into variable-sized segments based on the logical divisions of a program
(e.g., code, data, stack).
Each segment has a base address and a limit.
3. Paged Segmentation:
A single CPU contains multiple cores, each capable of executing tasks independently.
Example: Modern Intel and AMD processors.
2️⃣ Multiprocessing:
1️⃣ Speed: Tasks are completed faster by dividing them among processors.
2️⃣ Efficiency: Maximizes the utilization of available resources.
3️⃣ Scalability: Can handle larger and more complex problems as resources grow.
4️⃣ Energy Efficiency: Multicore processors can achieve better performance per watt.
Pipelining is a technique where multiple instructions are overlapped during execution. Each
instruction is divided into stages, and each stage is processed concurrently.
Example:
If one instruction takes 5 cycles, a pipeline allows the CPU to execute multiple instructions
simultaneously, achieving one instruction per cycle after the pipeline is full.
7.5 Describe a Basic Pipeline for a Computer System
1. Structural Hazards:
Occur when multiple instructions need the same hardware resource at the same time.
Example: Two instructions require access to memory simultaneously.
2. Data Hazards:
Occur when an instruction depends on the result of a previous instruction that hasn’t
completed.
Types:
o RAW (Read After Write): Reading data before it’s written.
o WAR (Write After Read): Writing data before it’s read.
3. Control Hazards:
Occur during branch instructions when the pipeline doesn’t know which instruction to
fetch next.
Example: Conditional jumps.