Complete Detailed Solutions · 2023 & 2024 Papers
(i) What is meant by data dependence?
Data dependence is a situation where an instruction relies on the result produced by a preceding instruction. For example, if Instruction A writes to register R1 and Instruction B reads R1, B is data-dependent on A. This is the fundamental cause of Data Hazards (RAW, WAW, WAR) in pipelined processors.
(ii) Which page replacement algorithm suffers from Belady's anomaly?
FIFO (First-In, First-Out). Belady's anomaly is the counter-intuitive phenomenon where increasing the number of page frames can actually increase the number of page faults. LRU and Optimal algorithms are "stack algorithms" and do not exhibit this anomaly.
(iii) Which architecture is/are suitable for realizing SIMD?
Array Processors and Vector Processors. Both apply a single instruction to multiple data elements simultaneously. Array processors use multiple identical Processing Elements (PEs) working in lockstep. Vector processors use deeply pipelined functional units to process entire vectors.
(iv) What is meant by Branch Prediction?
Branch Prediction is a hardware technique where the processor guesses the outcome of a conditional branch (taken or not taken) and its target address before the branch condition is actually evaluated. This allows the pipeline to continue fetching instructions speculatively, avoiding stalls. Modern predictors achieve >95% accuracy.
(v) The throughput of a superscalar processor is ____.
Greater than 1 instruction per clock cycle. An n-way superscalar can theoretically complete up to n instructions per cycle (IPC > 1).
(vi) Which unit is responsible for translation of logical address to physical address?
Memory Management Unit (MMU). It uses the Page Table (cached in the TLB) to translate virtual page numbers to physical frame numbers.
(vii) The ____ plays a very vital role in case of superscalar processors.
Instruction Fetch/Decode/Issue unit. This front-end must fetch, decode, and dispatch multiple instructions per cycle. A bottleneck here starves the execution units.
(viii) The set of loosely connected computers are called as ____.
Cluster (also called a Distributed System or Multicomputer). Each node has its own private memory and OS; they communicate via message passing.
(ix) Write the equation for Amdahl's Law.
Where P = fraction of the program that can be parallelized, N = number of processors. The term (1 − P) is the sequential bottleneck that limits maximum speedup.
(x) Write the statement for memory inclusion property.
Inclusion Property: Any block of data present in a higher-level (smaller, faster) cache (e.g., L1) must also be present in every lower-level (larger, slower) cache (e.g., L2, L3). This simplifies coherence protocols because snooping only the outermost cache is sufficient.
(xi) What is meant by instruction level parallelism?
Instruction Level Parallelism (ILP) is the measure of how many instructions in a program can be executed simultaneously because they are independent of each other. ILP is exploited by pipelining, superscalar execution, VLIW, and out-of-order execution. Typical ILP in real programs: 2–5.
(xii) In tightly coupled systems, the microprocessors share ____.
A common main memory. This shared-memory architecture allows fast communication between processors through shared variables, coordinated by cache coherence protocols.
Given: A 4-segment pipeline with delays: S1 = 40 ns, S2 = 25 ns, S3 = 45 ns, S4 = 45 ns. Interface register delay = 5 ns. Number of tasks = 100.
Step 1 — Cycle Times:
Step 2 — Execution Time for 100 Tasks:
Step 3 — Real Speedup:
Step 4 — Maximum Speedup:
As n → ∞, the pipeline startup cost (k cycles) becomes negligible:
Note: The theoretical maximum speedup for k stages is k = 4, but because the stages are unbalanced (25 ns vs 45 ns) and the register delay adds overhead, the actual maximum is only 3.1.
Given: Clock Rate = 1.8 GHz. Instruction mix:
Step 1 — Calculate CPI (Cycles Per Instruction):
CPI = (0.40 × 1) + (0.20 × 2) + (0.10 × 2) + (0.30 × 2)
CPI = 0.40 + 0.40 + 0.20 + 0.60
Step 2 — Calculate MIPS Rating:
MIPS = (1.8 × 10⁹) / (1.6 × 10⁶)
MIPS = 1,800 / 1.6
Interpretation:
Superscalar Processor:
A superscalar processor is a CPU that implements instruction-level parallelism (ILP) within a single processor core. It can fetch, decode, and dispatch multiple instructions simultaneously to multiple parallel execution units (integer ALUs, FP units, load/store units) in a single clock cycle. The key hardware components enabling this are:
Examples: Intel Core i7 (6-wide issue), AMD Ryzen (6-wide), Apple M-series (8-wide).
Advantages of Vector Computers:
VADDPS) operates on an entire array of 64 or more elements, dramatically reducing the number of instructions fetched, decoded, and issued compared to scalar code that requires a loop.Static Networks vs Dynamic Networks:
Key Differences:
Hypercube Interconnection (n = 3):
A hypercube of dimension n connects 2ⁿ nodes. For n = 3: 2³ = 8 nodes, labeled 000 through 111 in binary.
Connection Rule: Two nodes are directly connected if and only if their binary addresses differ in exactly one bit position.
Properties: Each node has exactly n = 3 neighbors. The network diameter (max hops between any two nodes) = n = 3. Total links = n × 2ⁿ / 2 = 3 × 8 / 2 = 12 links. The topology forms a 3D cube.
All three architectures aim to increase instruction throughput beyond a simple pipelined processor. They differ in how they achieve parallelism:
1. Superscalar (Spatial Parallelism):
2. Super-Pipelined (Temporal Parallelism):
3. Superscalar-Super-Pipelined (Combined):
Key Comparison:
(a) Tightly Coupled vs. Loosely Coupled Systems:
| Aspect | Tightly Coupled (Multiprocessor) | Loosely Coupled (Multicomputer / Cluster) |
|---|---|---|
| Memory | Shared common main memory (global address space) | Each processor has its own private local memory |
| Communication | Through shared memory (load/store) | Through message passing (send/receive) over a network |
| OS | Single OS manages all processors | Each node runs its own OS instance |
| Latency | Low (shared memory access: ~100 ns) | High (network message: ~1–100 μs) |
| Scalability | Limited (bus/memory contention at ~64 processors) | Highly scalable (thousands of nodes) |
| Programming Model | Easier (shared variables, threads, OpenMP) | Harder (explicit message passing, MPI) |
| Coherence | Requires cache coherence protocols (MESI) | Not needed (no shared caches) |
| Examples | Multi-core CPUs, SMP servers | Beowulf clusters, Google's data centers |
(b) Multiprocessor Architectures — UMA, NUMA, COMA:
1. UMA (Uniform Memory Access):
2. NUMA (Non-Uniform Memory Access):
3. COMA (Cache-Only Memory Architecture):
(a) Page Fault:
A Page Fault is an exception (interrupt) generated by the MMU hardware when a program accesses a virtual page whose valid bit in the page table is 0 — meaning the page is currently on disk (swap space), not in physical RAM. The OS page fault handler then: (1) selects a victim page if all frames are full, (2) writes the victim to disk if dirty, (3) reads the requested page from disk into the freed frame, (4) updates the page table entry, (5) restarts the faulting instruction.
(b) Page Replacement — Step-by-Step Trace:
Reference String: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6 (20 references). Assume 3 frames.
FIFO (First-In, First-Out):
Replace the page that has been in memory the longest (oldest arrival).
| Ref | 1 | 2 | 3 | 4 | 2 | 1 | 5 | 6 | 2 | 1 | 2 | 3 | 7 | 6 | 3 | 2 | 1 | 2 | 3 | 6 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| F1 | 1 | 1 | 1 | 4 | 4 | 4 | 4 | 6 | 6 | 6 | 6 | 3 | 3 | 3 | 3 | 2 | 2 | 2 | 2 | 6 |
| F2 | 2 | 2 | 2 | 2 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 7 | 7 | 7 | 7 | 1 | 1 | 1 | 1 | |
| F3 | 3 | 3 | 3 | 3 | 5 | 5 | 5 | 1 | 1 | 1 | 1 | 6 | 6 | 6 | 6 | 6 | 3 | 3 | ||
| F/H | F | F | F | F | H | F | F | F | F | F | H | F | F | F | H | F | F | H | F | F |
LRU (Least Recently Used): Replace the page that hasn't been used for the longest time.
Optimal (Belady's Algorithm): Replace the page that won't be used for the longest time in the future.
Comparison: Optimal ≤ LRU ≤ FIFO in terms of fault rates, as expected. Optimal is the theoretical best but is not implementable in practice (requires future knowledge). LRU is a practical near-optimal approximation.
(c) Virtual Memory through Segmentation:
Segmentation divides the virtual address space into variable-sized logical units called segments, each corresponding to a logical entity like:
Address Translation: A virtual address is a pair: (Segment Number, Offset). The OS maintains a Segment Table for each process. Each entry contains:
Offset < Limit to enforce protection.Physical Address = Base + Offset (if Offset < Limit, else → Segmentation Fault).
Advantage over paging: Segments match the logical structure of a program, making protection and sharing easier. Disadvantage: Variable-sized segments cause external fragmentation in physical memory.
(a) SIMD Array Processor Architecture [5]:
SIMD (Single Instruction, Multiple Data) is one of Flynn's four classifications. In an SIMD architecture, a single control unit broadcasts one instruction to multiple Processing Elements (PEs) that operate on different data elements simultaneously.
(b) Vector Stride and Vectorization [2]:
for(i=0; i<64; i++) C[i] = A[i] + B[i]; into a single VADD V3, V1, V2 instruction.(c) Scalar Processor vs. Vector Processor [2]:
(d) Vector Gather and Scatter Operations [6]:
Gather and Scatter are special vector memory operations designed to handle indirect (indexed) memory access patterns — situations where vector elements are not stored contiguously in memory.
Gather (Indexed Load):
VGATHER V1, M, V_index loads V1 = [M[3], M[7], M[1], M[9]].Scatter (Indexed Store):
VSCATTER M, V1, V_index writes M[3]=a, M[7]=b, M[1]=c, M[9]=d.Performance Note: Gather/Scatter operations are significantly slower than unit-stride vector loads/stores because each element requires a separate, potentially non-sequential memory access. Modern vector processors optimize these using memory bank interleaving and address coalescing.
(a) Cache Coherency [2]:
Cache Coherency is the discipline that ensures all processors in a multiprocessor system observe a consistent view of memory. Specifically, if Processor A writes value X to address 0x1000, then any subsequent read of 0x1000 by Processor B must return X (or a later value), not a stale cached copy. Without coherence, parallel programs produce incorrect results.
Formal Conditions (for coherence to hold):
(b) MESI Protocol [3]:
MESI is the most widely used snoopy cache coherence protocol. Each cache line has a 2-bit state tag:
Key Transitions:
(c) Snoopy Bus Protocol (Detailed) [6]:
Snoopy protocols rely on a shared bus that all cache controllers monitor (snoop).
(d) Synchronization in Multiprocessors [4]:
Synchronization ensures that multiple processors accessing shared data do so in a coordinated manner, preventing race conditions and ensuring correctness.
while(TAS(&lock) == 1) { /* spin */ }.(a) VLIW Architecture (Detailed) [6]:
VLIW (Very Long Instruction Word) is a processor architecture that achieves ILP through static (compile-time) scheduling rather than dynamic (hardware) scheduling.
(b) Advantages and Disadvantages of VLIW [5]:
Advantages:
Disadvantages:
(c) Hurdles in Superscalar Performance [4]: