Computer ArchitectureUnit 911 min read
Parallel Architectures & Flynn’s Classification: Types, Trade-offs & Real-World Use
Unit 9 of Computer Architecture explores parallel processing architectures (SIMD, MIMD, etc.), Flynn’s four-class taxonomy, hardware/software trade-offs, and how modern systems (GPUs, supercomputers, cloud) exploit parallelism—with Nepalese and global examples like eSewa’s transaction queues and Ncell’s call routing.
TAKEAWAYS:
- Flynn’s classification divides architectures into SISD, SIMD, MISD, MIMD based on instruction/operation streams, with SIMD (e.g., GPUs) and MIMD (e.g., cloud clusters) dominating modern systems.
- SIMD excels at data parallelism (e.g., video encoding), while MIMD handles task parallelism (e.g., web servers), but introduces complexity in synchronization and load balancing.
- Amdahl’s Law quantifies speedup limits: even 1% sequential code caps total speedup, forcing architects to minimize serial bottlenecks (e.g., database locks in eSewa).
- Hardware parallelism (e.g., multi-core CPUs) vs. software parallelism (e.g., OpenMP threads) each have trade-offs in cost, power, and scalability—critical for Nepal’s resource-constrained servers.
- Real-world mapping: Pathao’s ride-matching uses MIMD (multiple dispatchers handling independent requests), while Daraz’s recommendation engine uses SIMD (same algorithm on user data).
- Exam focus: Memorize Flynn’s 2×2 grid, compare SIMD/MIMD with pro/con tables, and apply Amdahl’s Law to speedup calculations (e.g., "If 20% of code is sequential, max speedup = 5×").
Core Concept: Flynn’s Taxonomy of Parallel Architectures
Flynn’s classification categorizes computers based on two dimensions:
- Instruction stream (I): Single (S) or Multiple (M).
- Data stream (D): Single (S) or Multiple (D).
This creates four classes, visualized below. Each has distinct hardware/software implications and real-world use cases.
classDiagram
class SISD {
+ Single instruction stream
+ Single data stream
+ Example: Von Neumann CPU
}
class SIMD {
+ Single instruction stream
+ Multiple data streams
+ Example: GPU, DSP
}
class MISD {
+ Multiple instruction streams
+ Single data stream
+ Example: Rare (e.g., pipeline hazards)
}
class MIMD {
+ Multiple instruction streams
+ Multiple data streams
+ Example: Multi-core servers, cloud
}
SISD --> "Evolves to" SIMD
SISD --> "Evolves to" MIMD
SIMD --> "Special case of" MIMD
MISD --> "Theoretical" MIMDKey Observations:
- SISD: Traditional single-core CPUs (e.g., older Intel Pentium). Limitation: No parallelism.
- SIMD: One instruction operates on multiple data (e.g., adding 1000 numbers at once). Use case: Graphics, signal processing.
- MISD: Rare; multiple instructions process the same data (e.g., error correction). Challenge: Hard to synchronize.
- MIMD: Most modern systems (e.g., your laptop’s 8-core CPU). Subtypes:
- Shared-memory MIMD: All cores access a common RAM (e.g., game consoles).
- Distributed-memory MIMD: Cores have local memory (e.g., supercomputers like Nepal’s Nepal Research Council’s HPC cluster).
In the Real World
eSewa’s Transaction Queue (MIMD)
- When you pay a bill via eSewa, your request joins a priority queue handled by multiple servers (MIMD). Each server processes a different transaction independently, but they must synchronize to avoid double-charging (e.g., using locks or distributed databases).
- Why MIMD? Scalability: Adding more servers (e.g., during Dashain) handles peak loads without redesigning the system.
Ncell’s Call Routing (SIMD + MIMD Hybrid)
- SIMD: When a call comes in, the same routing algorithm (e.g., "find the nearest tower") runs on multiple data streams (all incoming calls).
- MIMD: Different call types (voice, SMS, data) are handled by separate processors (e.g., voice calls go to a dedicated SIMD array, while SMS uses a simpler pipeline).
- Real hardware: Ncell’s baseband processors (like Qualcomm’s Snapdragon) use SIMD for signal processing, while the network core uses MIMD for load balancing.
Daraz’s Recommendation Engine (SIMD)
- When you browse Daraz, the "Recommended for You" section uses matrix multiplication (a SIMD operation) to compare your past purchases with all products. A single instruction (e.g., "multiply these two vectors") runs on thousands of user-product pairs simultaneously using GPU acceleration.
- Nepal-specific: Daraz’s Nepal warehouse uses MIMD for order fulfillment—different robots pick items in parallel, but must coordinate to avoid stockouts.
Worked Example: Amdahl’s Law in Kathmandu Traffic
Scenario: Imagine Kathmandu’s traffic lights are controlled by a parallel system. 30% of intersections are sequential (must wait for pedestrian buttons), and 70% are parallelizable (can be optimized independently). If we add more processors to the parallel 70%, what’s the maximum speedup?
Solution: Amdahl’s Law states: Where:
- (parallelizable fraction),
- (infinite processors for the parallel part).
Plugging in: Interpretation: Even with unlimited processors, the sequential 30% caps speedup to 3.33×. Real-world fix: Reduce sequential bottlenecks (e.g., prioritize pedestrian buttons or use AI to predict traffic patterns).
Hardware vs. Software Parallelism
| Aspect | Hardware Parallelism (e.g., Multi-core CPUs) | Software Parallelism (e.g., OpenMP, MPI) |
|---|---|---|
| Definition | Multiple physical cores/execution units. | Single core, but multiple threads/processes. |
| Example | Intel Core i7 (4–16 cores), NVIDIA GPU (1000s of cores). | Python’s multiprocessing, Java threads. |
| Synchronization | Shared cache/memory (complexity: cache coherence). | Explicit locks, message passing (e.g., MPI). |
| Scalability | Limited by die size/power (e.g., 100-core CPUs are rare). | Limited by OS overhead (e.g., context switching). |
| Use in Nepal | Nepal Rastra Bank’s servers: Multi-core for fraud detection. | eSewa’s backend: Thread pools for handling payments. |
SIMD: Deep Dive with a GPU Example
How GPUs Use SIMD: Modern GPUs (e.g., NVIDIA’s RTX 4090) have thousands of SIMD lanes (called "CUDA cores"). Each lane executes the same instruction on different data, ideal for:
- Matrix operations (e.g., deep learning),
- Pixel shading (e.g., video games),
- Signal processing (e.g., Ncell’s 5G beamforming).
Example: Rendering a 3D Scene (e.g., in GTA V on Steam)
- Single Instruction: "Apply lighting to this pixel."
- Multiple Data: The instruction runs on millions of pixels in parallel.
- Hardware: Each GPU core processes 32–64 pixels (a "warp") simultaneously.
sequenceDiagram
participant CPU
participant GPU
participant Framebuffer
CPU->>GPU: Submit render command (SIMD)
GPU->>GPU: Divide work into warps (32 threads each)
loop For each pixel
GPU->>GPU: Apply vertex shader
GPU->>GPU: Rasterize
GPU->>GPU: Fragment shader (same code, different pixels)
end
GPU->>Framebuffer: Write outputNepalese Application:
- Nepal’s weather forecasting: Uses GPUs to run SIMD-optimized fluid dynamics (e.g., simulating monsoon rains across the country in parallel).
- eSewa’s fraud detection: GPUs scan transaction patterns (e.g., "Is this user’s spending SIMD-like across merchants?").
MIMD: Distributed Systems in Cloud Computing
Example: Google’s Data Centers (MIMD) Google’s Borg system (used for YouTube, Search) runs millions of tasks across thousands of machines. Each machine:
- Has its own CPU/memory (distributed-memory MIMD).
- Communicates via remote procedure calls (RPC).
- Uses MapReduce (a software framework) to split jobs (e.g., indexing web pages) into parallel tasks.
How It Works:
- Task Division: A single job (e.g., "index all Nepali Wikipedia pages") is split into subtasks (e.g., "index page X").
- Independent Execution: Each subtask runs on a different machine (MIMD).
- Synchronization: Results are merged at the end (e.g., combining indexed pages into a search database).
stateDiagram-v2
[*] --> Idle
Idle --> Running: Job submitted
Running --> Split: Divide into tasks
Split --> Execute: Assign to MIMD nodes
Execute --> Synchronize: Merge results
Synchronize --> [*]: Job completeNepalese Example: NTC’s Network Monitoring
- NTC’s distributed sensors across Nepal use MIMD to monitor fiber-optic cables.
- Each sensor (e.g., in Kathmandu, Pokhara, Dhangadi) runs independently but reports to a central system.
- Challenge: Synchronizing clocks across sensors (solved using NTP protocol).
MISD: The "Forgotten" Class
MISD is rare because it’s hard to pipeline multiple instructions on the same data stream. One real-world use:
- Error correction in communication: Multiple algorithms (e.g., CRC, Hamming codes) check the same data stream to detect errors.
- Example: When you send money via Khalti, multiple validation steps (e.g., "Is the account valid?", "Is the amount correct?") run in parallel on the same transaction data.
Why Not More MISD?
- Hardware complexity: Requires precise synchronization.
- Software overhead: Managing multiple instruction streams is error-prone.
Performance Trade-offs: SIMD vs. MIMD
| Metric | SIMD | MIMD |
|---|---|---|
| Strength | High throughput for data-parallel tasks. | Flexibility for task-parallel tasks. |
| Weakness | Poor for divergent control flow (e.g., if-else branches). | Complex synchronization (e.g., deadlocks). |
| Power Efficiency | High (many cores do the same work). | Lower (idle cores waste power). |
| Example in Nepal | Ncell’s 5G base stations: SIMD for signal processing. | Nepal Stock Exchange (NEPSE): MIMD for order matching. |
Worked Example: Choosing SIMD vs. MIMD for a Bank Loan Calculator Scenario: A bank wants to calculate loan EMIs for 10,000 customers. Should they use SIMD or MIMD?
Analysis:
- SIMD: Apply the same EMI formula to all 10,000 loans in parallel. Best if:
- All loans have the same formula (no branches).
- Data fits in GPU memory.
- MIMD: Use multiple servers, each calculating a subset of loans. Best if:
- Loan types vary (e.g., some need complex risk analysis).
- Data is too large for one machine.
Decision: Use SIMD for bulk calculations (e.g., standard home loans) and MIMD for custom cases (e.g., business loans with variable rates).
Exam Tip: How to Score Full Marks
- Flynn’s Grid: Always draw the 2×2 table with examples. Examiners love this.
flowchart TD A["SISD<br/>Von Neumann"] -->|"Add parallel data"| B["SIMD<br/>GPU"] A -->|"Add parallel instructions"| C["MIMD<br/>Cloud"] B -->|"Add parallel instructions"| C - Amdahl’s Law: Memorize the formula and apply it to real scenarios (e.g., "If 40% of code is sequential, max speedup = 1.67×").
- Compare SIMD/MIMD: Use a table with Nepalese examples (e.g., eSewa vs. Daraz).
- Hardware/Software: Link to real systems:
- SIMD: GPUs, DSPs (e.g., in Ncell’s modems).
- MIMD: Multi-core CPUs, cloud (e.g., Nepal’s Nepal Government Cloud).
- Avoid MISD: Unless asked, skip it—it’s a trick question.
- Diagrams: For pipelining or synchronization, draw a timeline or state diagram (e.g., how threads wait for locks).
Common Pitfalls:
- Confusing SIMD (same instruction, multiple data) with MIMD (multiple instructions, multiple data).
- Forgetting Amdahl’s Law—always check for sequential bottlenecks.
- Ignoring real-world constraints (e.g., power in Nepal’s data centers).
Based on the TU BSc CSIT syllabus for Computer Architecture (CSC213), unit 9.
Discussion
Loading…