∑GateAndNet
PlannerSign Up
ADVANCEDFrequently Tested 4 min read 3 views

COA 2027 Rank-Decider: Write-Back Dirty Evictions, VIPT Cache Constraint & 2-Bit Branch Predictors

Write-Through vs Write-Back + Write-Allocate memory traffic numericals, Virtually Indexed Physically Tagged (VIPT) synonym-free page-size bound, 1-bit vs 2-bit saturating branch predictors, and MSI/MESI coherence.

1. Write-Through vs Write-Back Memory Traffic (Classic 2-Mark GATE NAT)

Policy PairOn Write HitOn Write MissExtra Metadata per Cache Line
Write-Through + No-Write-AllocateUpdates Cache AND Main MemoryWrites directly to Main Memory onlyValid bit (11 bit)
Write-Back + Write-AllocateUpdates Cache only, sets Dirty = 1Fetches block into Cache, then writes (Dirty = 1)Valid (11) + Dirty (11) bits
Common Exam Mistake

Dirty-Bit Eviction Trap: In a Write-Back cache, a read or write miss that evicts a clean block (Dirty = 0) performs 11 memory block transfer (fetch new block). If the evicted victim is dirty (Dirty = 1), it performs 22 memory block transfers (write back dirty victim + fetch new block)!

2. Virtually Indexed, Physically Tagged (VIPT) L1 Caches

Why do modern CPUs use VIPT for L1 caches? Because bits [Page_Offset - 1 : 0] are identical in Virtual and Physical addresses! If Set_Index + Block_Offset <= Page_Offset, the CPU indexes the L1 SRAM sets in parallel with the TLB translation — achieving virtual-cache speed with physical-cache tag safety and zero aliasing!

  • Example: With 4 KB4\text{ KB} (2122^{12}) pages and an 88-way set-associative L1 cache, maximum alias-free VIPT cache size is 8×4 KB=32 KB8 \times 4\text{ KB} = \mathbf{32\text{ KB}} (exact Intel/ARM L1 design!).

3. Dynamic Branch Prediction: 1-Bit vs 2-Bit Saturating Counter

Consider an inner loop executing NN iterations per outer-loop invocation:

  • 1-Bit Predictor: Mispredicts twice per outer invocation — once when exiting the loop (T→NTT \to NT), AND once upon re-entering the loop on the next outer pass! Steady-state misprediction rate =2N= \mathbf{\frac{2}{N}}.
  • 2-Bit Saturating Counter (00 SNT, 01 WNT, 10 WT, 11 ST): Requires two consecutive wrong outcomes to flip prediction! Exiting the loop moves 11 (ST) -> 10 (WT) (still predicts Taken on next entry!), so steady-state misprediction rate drops in half to 1N\frac{1}{N}!
Key Formulas Summary
VIPT Cache Parallel TLB Lookup (Zero-Aliasing) Condition
Set Index Bits+Block Offset Bits≤Page Offset Bits  ⟺  Cache SizeAssociativity K≤Page Size\text{Set Index Bits} + \text{Block Offset Bits} \le \text{Page Offset Bits} \iff \frac{\text{Cache Size}}{\text{Associativity } K} \le \text{Page Size}
Note: To double VIPT L1 cache size without changing 4 KB OS page size, DOUBLE the associativity K!
Write-Back Cache Effective Memory Access Time (with Dirty Eviction Probability d)
AMATWB=Thit+m⋅(1+d)⋅Tblock_transfer\text{AMAT}_{\text{WB}} = T_{\text{hit}} + m \cdot (1 + d) \cdot T_{\text{block\_transfer}}
Note: m = miss rate, d = fraction of evicted cache lines that have Dirty Bit = 1 (require write-back + read)!
#COA#VIPT Cache#Write-Back#Branch Prediction#Cache Coherence#GATE CS 2027

Practice Questions on This Chapter (3)

Q1GATE CS 2027 Expected NATNATHARD
+2M • 0 Neg

A processor uses 4 KB4\text{ KB} virtual pages and a Virtually Indexed, Physically Tagged (VIPT) L1 data cache with 64-byte64\text{-byte} cache blocks. To avoid virtual aliasing without OS page coloring (so Set Index + Block Offset ≤\le Page Offset), what is the minimum set-associativity KK required for a 64 KB64\text{ KB} L1 cache?

Q2GATE CS 2026–27 ExpectedNATMEDIUM
+2M • 0 Neg

A Write-Back, Write-Allocate L1 cache has hit time 1 ns1\text{ ns} and miss rate 5%5\%. Transferring one 64-byte64\text{-byte} cache block to or from Main Memory takes 40 ns40\text{ ns}, and 30%30\% of evicted cache blocks are dirty. What is the Average Memory Access Time (AMAT) in nanoseconds?

Q3GATE CS 2027 ExpectedMCQMEDIUM
+2M • -0.67

An inner for loop executes exactly 1010 iterations each time an outer while loop invokes it (1,0001,000 outer invocations). What are the steady-state branch prediction accuracies on the inner-loop backward branch for a 1-bit predictor vs a 2-bit saturating counter predictor?

⚡ Click an option above to verify instantly
Previous TopicAddressing Modes, Hardwired vs Microprogrammed Control Unit & DMA I/ONext Topic C Pointers, Static Storage, Array Decay & Tricky Output Patterns