Pipelining, Flynn's Taxonomy & Parallel Processing
Subject: Computer Architecture and Organization
Instruction Pipelining, Pipeline Hazards (Structural, Data, Control), Speedup ratio, Flynn's Classification (SISD, SIMD, MISD, MIMD).
Concept Summary
Key Revision Rules & Formulas
- 🚀 Pipelining Speedup & Execution Time: For n instructions in a k-stage pipeline with clock cycle t_clk, Total Time = [k + (n - 1)] * t_clk. Ideal Speedup S = k (for infinite instructions n -> infinity). Actual Speedup S = (n * k) / [k + (n - 1)].
- ⏱️ Clock Cycle Time Formula: t_clk = max(stage delays) + t_r, where t_r is the pipeline register delay.
- ⚠️ Pipeline Hazards Overview: 1) Structural Hazards (Resource conflicts, e.g., single memory port for Instruction & Data), 2) Data Hazards (RAW/Read-After-Write, WAR/Write-After-Read, WAW/Write-After-Write), 3) Control Hazards (Branching, Jumps, Calls).
- ⚡ Data Forwarding (Bypassing): Resolves ALU-to-ALU RAW data hazards with 0 stalls by routing computed values from EX/MEM or MEM/WB pipeline registers directly to ALU inputs in subsequent cycles.
- ⏳ Load-Use Data Hazard: A Load instruction (LW) followed immediately by a dependent instruction requires 1 STALL CYCLE (bubble) even with forwarding, because loaded data is available only at the end of MEM stage (Stage 4).
- 🎯 Branch Penalty & Control Hazards: Resolving branch target at EX stage (Stage 3) incurs a 2-cycle penalty for taken branches if no branch prediction is used. Advanced techniques: Branch Prediction (Static/Dynamic), Delayed Branching.
- 💻 Flynn's Taxonomy Classification: 1) SISD (Traditional single CPU), 2) SIMD (GPUs, Vector processors, Array processors - single instruction stream on multiple data streams), 3) MISD (Redundant fault-tolerant systems, Systolic arrays - multiple instructions on single data stream), 4) MIMD (Multicore CPUs, Clusters, Multiprocessors).
- 📈 Amdahl's Law (Speedup Limit): Speedup S(N) = 1 / [(1 - f) + (f / N)], where f is the parallel fraction and (1 - f) is the sequential fraction. Maximum theoretical speedup limit as N -> infinity is S_max = 1 / (1 - f).
- 🧠 UMA vs. NUMA Memory Architectures: Uniform Memory Access (UMA / SMP) provides equal access latency to main memory for all CPUs via shared bus. Non-Uniform Memory Access (NUMA) distributes physical RAM across processor nodes, making local memory access faster than remote memory access.
- 🔀 Hardware Multithreading (SMT vs. Fine-Grained): Simultaneous Multithreading (SMT / Hyper-Threading) allows wide superscalar issue logic to issue instructions from MULTIPLE independent threads in the EXACT SAME clock cycle.
Common Exam Pitfalls
- Mistake: Calculating ideal speedup ratio as k for infinite instructions, but forgetting that for finite n instructions, Speedup = (n * k) / [k + (n - 1)].
- Mistake: Assuming Data Forwarding eliminates ALL data hazards. A Load-Use hazard (LW followed by ADD) strictly requires 1 stall cycle even with full forwarding.
- Mistake: Confusing SIMD (Vector / GPU array processing) with MIMD (Multi-core independent threading).
- Mistake: Forgetting to add register delay (t_r) when calculating pipeline clock cycle time t_clk = max(stage_delays) + t_r.
- Mistake: Assuming Amdahl's Law allows infinite speedup when core count N -> infinity (Speedup is hard-capped at 1 / (1 - f) by the sequential portion).
Sample Practice Questions
Question 1: MIMD का अर्थ है -
- Multiple Instruction Memory Data
- Multiple Instruction Multiple Data
- Memory Instruction Multiple Data
- Memory Information Memory Data
Explanation:
Question 2: दो या दो से अधिक निर्देशों का एक साथ निस्पादन क्या कहलाता है -
- अनुक्रमिक अभिगम
- रिड्यूस्ड इन्स्ट्रक्शन सेट
- मल्टीप्रोसेसिंग
- डिस्क मिररिंग
Explanation: मल्टीप्रोसेसिंग में एक से अधिक प्रोसेसर एक साथ कई निर्देशों को निष्पादित करते हैं।
Question 3: यदि किसी कंप्यूटर में एक से अधिक प्रोसेसर हों तो उसे क्या कहते हैं -
- यूनिप्रोसेसर
- मल्टीप्रोसेसर
- मल्टीथ्रेडेड
- मल्टीप्रोग्रामिंग
Explanation: कंप्यूटर विज्ञान के संदर्भ में मल्टीपल प्रोसेसर एक ऐसी प्रणाली को संदर्भित करता है जिसमें दो या अधिक प्रोसेसर एक साथ काम करते हैं।
Question 4: मल्टीपल प्रोसेसरों द्वारा दो या अधिक प्रोग्रामों का साथ–साथ प्रासेसिंग है -
- मल्टीप्रोग्रामिंग
- मल्टीटासिंकग
- टाइम शेयरिंग
- मल्टीप्रोसेसिंग
Explanation: मल्टीप्रोसेसिंग (Multiprocessing) वह तकनीक है जिसमें एक कंप्यूटर सिस्टम में एक से अधिक प्रोसेसर होते हैं और वे एक साथ दो या अधिक प्रोग्रामों या प्रक्रियाओं को प्रोसेस करते हैं। इसका मुख्य उद्देश्य प्रोसेसिंग स्पीड को बढ़ाना और सिस्टम की क्षमता को बेहतर बनाना होता है।
Question 5: In Flynn's Taxonomy, supercomputers with multiple vector execution pipelines processing arrays of data under a single instruction stream are classified under:
- SISD (Single Instruction, Single Data)
- SIMD (Single Instruction, Multiple Data)
- MISD (Multiple Instruction, Single Data)
- MIMD (Multiple Instruction, Multiple Data)
Explanation: SIMD (Single Instruction Multiple Data) architecture executes one instruction across multiple processing elements simultaneously on different data operands (typical for vector/array processors and GPUs).
Question 6: What type of pipeline hazard occurs when an instruction depends on the result of a previous instruction that has not yet completed execution?
- Structural Hazard
- Data Hazard (RAW - Read After Write)
- Control Hazard (Branch Hazard)
- Memory Alignment Hazard
Explanation: A Data Hazard (specifically Read-After-Write or RAW dependency) occurs when an instruction tries to read a register operand before a preceding instruction has written its calculated output back to that register.
Question 7: A 4-stage instruction pipeline processes 100 instructions. Assuming ideal execution without any pipeline stalls or hazards, how many total clock cycles are required?
- 400 cycles
- 100 cycles
- 103 cycles
- 104 cycles
Explanation: For a k-stage pipeline executing n instructions: Total Clock Cycles T = k + (n - 1). Here k = 4 and n = 100, so T = 4 + 99 = 103 cycles.
Question 8: What is the maximum theoretical speedup ratio S for a k-stage instruction pipeline executing n instructions as n approaches infinity?
- S = k
- S = k / 2
- S = n
- S = k * n
Explanation: For a k-stage pipeline executing n instructions, Speedup S = (n * k) / (k + n - 1). As n -> infinity, S approaches k.
Question 9: What type of pipeline hazard occurs when two overlapping instructions attempt to access the same physical hardware resource simultaneously?
- Structural Hazard (Resource Hazard)
- Data Hazard (RAW Hazard)
- Control Hazard (Branch Hazard)
- Memory Alignment Hazard
Explanation: A Structural Hazard occurs when hardware resource contention (e.g. single port memory accessed by Fetch and Memory stages concurrently) prevents simultaneous execution.
Question 10: In Flynn's Taxonomy, how are conventional single-core uniprocessor systems classified?
- SISD (Single Instruction, Single Data)
- SIMD (Single Instruction, Multiple Data)
- MISD (Multiple Instruction, Single Data)
- MIMD (Multiple Instruction, Multiple Data)
Explanation: SISD (Single Instruction Single Data) represents standard uniprocessors executing one instruction stream on one data stream at a time.