π 1. Peripheral Devices
Types & Examples
| Type | Function | Examples |
|---|---|---|
| Input Devices | Send data to computer | Keyboard, Mouse, Scanner, Webcam, Microphone |
| Output Devices | Receive data from computer | Monitor, Printer, Speakers, Projector |
| Storage Devices | Store data permanently | HDD, SSD, USB Drive, SD Card |
| Communication Devices | Enable data transmission | Modem, Router, Bluetooth Adapter, NIC |
π 2. I/O Interface
Key Functions
- Command Decoding β Interprets control signals from CPU
- Data Buffering β Temporarily stores data to match speed differences
- Signal Conversion β Converts digital/analog signals
- Timing & Control β Synchronizes operations between CPU and devices
- Error Detection β Identifies transmission errors using parity bits
- Status Reporting β Informs CPU about device readiness
Interface Types
Serial Interface
Data transmitted bit-by-bit sequentially
Examples: USB, RS-232, SATA
Parallel Interface
Multiple bits transmitted simultaneously
Examples: Printer Port, IDE
π 3. Asynchronous Data Transfer
Methods
A) Strobe Control
A strobe signal indicates when data is valid on the data bus.
Strobe: _____|βΎβΎ|______
β Unidirectional communication
β Simpler implementation
β Less reliable
B) Handshaking Method
Two-way acknowledgment system for reliable data transfer.
β No clock synchronization needed
β Flexible timing
β Better error detection
β More reliable data transfer
β‘ 4. Interrupts
Interrupt Processing Steps
- Device sends interrupt signal
- CPU completes current instruction
- CPU saves Program Counter (PC) and registers
- Control transfers to ISR
- ISR executes
- Restore saved context
- Resume interrupted program
Types of Interrupts
| Type | Description | Example |
|---|---|---|
| Hardware | External devices | Keyboard, Timer, Mouse |
| Software | Program instructions | System call, INT 21H |
| Maskable | Can be disabled | I/O device interrupts |
| Non-Maskable | Cannot be disabled | Power failure, Memory error |
| Vectored | ISR address predefined | 8086 interrupts |
| Non-Vectored | Device provides address | Requires polling |
π€ 5. Modes of Data Transfer
1. Programmed I/O (Polling)
β Simple implementation
β No additional hardware
β CPU time wasted
β Inefficient for slow devices
β Cannot multitask
2. Interrupt-Driven I/O
β CPU not wasted
β Better efficiency
β Supports multitasking
β Interrupt overhead
β Complex implementation
3. Direct Memory Access (DMA)
DMA Controller Components
- Address Register β Memory address pointer
- Word Count Register β Number of bytes to transfer
- Control Register β R/W mode, transfer type
- Status Register β Transfer status
DMA Transfer Process
DMA Transfer Modes
Burst Mode
DMA takes complete bus control and transfers entire block at once
Cycle Stealing
DMA steals one bus cycle at a time, minimal CPU interruption
Transparent Mode
DMA transfers only when CPU is not using the bus
β Fastest data transfer
β CPU completely free
β Suitable for high-speed devices
β Efficient for bulk data
Comparison of Data Transfer Modes
| Feature | Programmed I/O | Interrupt I/O | DMA |
|---|---|---|---|
| CPU Usage | Continuous | Minimal | Initial only |
| Speed | Slowest | Medium | Fastest |
| Efficiency | Very Low | Medium | High |
| Hardware Cost | Low | Medium | High |
| Best For | Simple devices | Keyboards, mice | Disk, video |
π₯οΈ 6. I/O Processor (IOP)
Functions of IOP
- Executes I/O channel programs
- Manages multiple I/O devices simultaneously
- Performs data buffering and formatting
- Handles error detection and correction
- Sends completion interrupts to CPU
- Reduces CPU workload significantly
|
System Bus
|
I/O Processor
/ | \
Dev1 Dev2 Dev3
β CPU freed from I/O management
β Parallel I/O operations possible
β Better system throughput
β Improved overall performance
βοΈ 1. Parallel Processing
Goals of Parallel Processing
- β‘ Increase execution speed
- β‘ Improve throughput
- β‘ Better resource utilization
- β‘ Handle complex computations efficiently
Types of Parallelism
Bit-Level
Processing multiple bits together (8-bit β 64-bit)
Instruction-Level
Multiple instructions executed simultaneously
Task-Level
Different tasks on different processors
Data-Level
Same operation on multiple data elements
π 2. Flynn's Classification
1. SISD (Single Instruction, Single Data)
RetryARContinueConcept: Traditional von Neumann architecture
Working: One instruction on one data at a time
Examples: Intel 8086, Early processors
2. SIMD (Single Instruction, Multiple Data)
Concept: One instruction operates on multiple data simultaneously
Working: Vector/array processing
β
[PE1] [PE2] [PE3]
β β β
Data1 Data2 Data3
Examples: GPUs, Intel SSE/AVX
Applications: Image processing, scientific computing
3. MISD (Multiple Instruction, Single Data)
Concept: Multiple instructions on same data
Working: Rarely implemented
Examples: Fault-tolerant systems
Note: Theoretical, not commonly used
4. MIMD (Multiple Instruction, Multiple Data)
Concept: Multiple processors, different instructions on different data
Working: True parallel computing
β β β
Data1 Data2 Data3
Examples: Multi-core CPUs, distributed systems
Applications: Web servers, databases
π 3. Instruction Level Parallelism (ILP)
Techniques to Achieve ILP
- Pipelining β Overlapping instruction stages
- Superscalar β Multiple instructions per cycle
- Out-of-Order Execution β Execute ready instructions first
- Branch Prediction β Predict branch outcomes
- Register Renaming β Eliminate false dependencies
- Speculative Execution β Execute before knowing if needed
π 4. Pipeline Processing
Classic 5-Stage Pipeline
Pipeline Execution Diagram
I1: IF ID EX ME WB
I2: IF ID EX ME WB
I3: IF ID EX ME
I4: IF ID EX
Analogy
- Worker 1: Installs chassis
- Worker 2: Installs engine
- Worker 3: Paints car
- Worker 4: Installs wheels
- Worker 5: Final inspection
Performance Metrics
1. Throughput
2. Speedup
3. Efficiency
β Increased throughput
β Better CPU utilization
β Faster execution
β No hardware duplication
β Pipeline hazards cause stalls
β Complex control logic
β Branch instructions create problems
β οΈ 5. Pipeline Hazards
1. Structural Hazards
What is it?
Hardware resource conflict - two instructions need same resource at same time.
Solutions:
- β Duplicate hardware resources
- β Separate instruction & data caches
- β Pipeline reorganization
- β Resource scheduling
2. Data Hazards
What is it?
Instruction depends on result of previous instruction that hasn't completed yet.
Types:
A) RAW (Read After Write) - True DependencySolutions:
1. Data Forwarding/Bypassing3. Control Hazards (Branch Hazards)
What is it?
Due to branch/jump instructions - pipeline doesn't know which instruction to fetch next.
Solutions:
1. Branch Prediction- Always predict taken/not taken
- Backward branches β taken (loops)
- Forward branches β not taken
- Use branch history
- 1-bit: Remember last outcome
- 2-bit: Change after 2 mispredictions
Comparison of Hazards
| Hazard | Cause | Main Solution | Impact |
|---|---|---|---|
| Structural | Resource conflict | Duplicate resources | Medium |
| Data (RAW) | Data dependency | Forwarding | Low-Medium |
| Control | Branch instructions | Branch prediction | High |
π 6. Performance Metrics
1. Throughput
2. Speedup
3. Efficiency
4. CPI (Cycles Per Instruction)
β‘ Quick Revision - Unit 3
πΉ I/O Subsystems - Flow
πΉ Peripheral Devices
| Type | Examples |
|---|---|
| Input | Keyboard, Mouse, Scanner |
| Output | Monitor, Printer, Speakers |
| Storage | HDD, SSD, USB |
| Communication | Modem, Router, NIC |
πΉ I/O Interface Functions
- Command decoding
- Buffering
- Signal conversion
- Timing & control
- Control signals
- Error detection
πΉ Asynchronous Transfer Methods
Strobe Control
β Single signal
β Simpler
β Less reliable
Handshaking
β Two-way acknowledgment
β More reliable
β Used in USB
πΉ Interrupt Types
πΉ Data Transfer Modes - MOST IMPORTANT!
| Mode | CPU Usage | Speed | Best For |
|---|---|---|---|
| Programmed I/O | CPU busy | Slowest | Simple devices |
| Interrupt-Driven | CPU free | Medium | Keyboard, mouse |
| DMA | CPU not used | Fastest | Disk, video |
πΉ DMA Key Points
- β Direct Memory Access
- β CPU only initializes
- β Data: Device β Memory (no CPU)
- β Interrupt on completion
- β 3 modes: Burst, Cycle Stealing, Transparent
πΉ I/O Processor (IOP)
πΉ Parallel Processing
πΉ Flynn's Classification - Super Important!
| Type | Example | Use Case |
|---|---|---|
| SISD | Old processors | Traditional |
| SIMD | GPU | Image processing |
| MISD | Rare | Fault-tolerant |
| MIMD | Multicore CPUs | Parallel computing |
πΉ Pipeline Processing
πΉ Pipeline Hazards - Must Know!
| Hazard | Cause | Solution |
|---|---|---|
| Structural | Resource conflict | Duplicate resources |
| Data (RAW) | Data dependency | Forwarding / Stalling |
| Control | Branch instructions | Branch prediction |
πΉ Data Hazards Types
πΉ Performance Terms
Throughput
Instructions per time
Higher = Better
Speedup
Non-pipelined / Pipelined
Ideal = Stages
Efficiency
(Actual/Ideal) Γ 100%
Closer to 100% = Better
CPI
Cycles Per Instruction
Ideal pipelined = 1
πΉ Last-Minute Formula Sheet
πΉ Important One-Liners for Exam
β NMI cannot be disabled
β Handshaking more reliable than strobe
β SIMD used in GPUs
β RAW is most common data hazard
β Branch prediction solves control hazards
β Forwarding solves data hazards
β Ideal speedup = number of stages
β IOP reduces CPU workload
β Interrupt-driven better than programmed I/O
πΉ Exam Tips
- "Fastest transfer?" β DMA
- "CPU free?" β Interrupt/DMA
- "Used in GPUs?" β SIMD
- "Most common hazard?" β Data (RAW)
- "Branch solution?" β Branch prediction
- "Pipeline stages?" β IF, ID, EX, MEM, WB