chapter

    Cache Memory, Memory Hierarchy and Address Translation Short Notes for Gate Cs

    Cache Memory, Memory Hierarchy and Address Translation short notes for GATE CS: 6 study cards covering concepts, formulas, shortcuts and exam traps, plus solv

    Cache Memory Memory Hierarchy and Address Translation short notes

    Quick Reference: Direct-Mapped Cache

    Essential Formulas

    Lines
    Index
    Offset
    Tag
    Key Points:
    • Direct-mapped: one block → one line
    • "Total tag storage" ≠ "tag bits"
    • Cache size ≤ main memory size

    Problem-Solving Checklist

    • Identify given information
    • Determine addressing mode (byte/word)
    • Calculate number of lines
    • Find index and offset bits
    • Calculate tag bits by subtraction
    • Verify: Tag + Index + Offset = Address

    Quick Reference: Set-Associative Cache

    Quick Reference

    Lines
    Sets
    Index
    Tag

    Problem-Solving Checklist

    • Identify given info
    • Determine forward/reverse
    • Calculate lines & sets
    • Find index & offset
    • Calculate tag or

    Conflict Misses — Quick Checklist

    Six-step checklist

    1. Word address? → multiply by word size in bytes.
    2. Find (block size) and (number of lines).
    3. Line = (address ÷ B) mod L for each address.
    4. Group addresses by line.
    5. Simulate or use shortcut: 1 address/line → 1 miss then hits; k addresses/line → every access misses.
    6. Sum hits and misses across all rounds.

    Remember: conflict miss = two different blocks, one line, alternating access. That is the whole game.

    3 more cards in this chapter

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    Level 1: Warm-up

    A processor uses 32-bit addresses and has a 128 KB, 8-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    Question 2
    Level 1: Warm-up

    A processor uses 32-bit addresses and has a 32 KB, 4-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    Question 3
    Level 1: Warm-up

    An urn contains 3 red and 2 black balls. A Polya Urn process is run for draws. For how many values of is the probability of drawing a red ball on the -th draw strictly greater than ?

    Question 4
    Level 1: Warm-up

    In a Polya Urn process starting with 2 red and 3 black balls, what is the expected number of red balls drawn in 10 draws?

    Question 5
    Level 1: Warm-up

    An urn initially contains 2 red and 8 black balls. A Polya Urn process is run. For how many values of is the expected proportion of red balls in the urn exactly ?

    Question 6
    Level 1: Warm-up

    Consider the following cache tagging strategies:

    1. VIVT (Virtual Index, Virtual Tag)
    2. PIPT (Physical Index, Physical Tag)
    3. VIPT (Virtual Index, Physical Tag)

    How many of these strategies inherently avoid the synonyms problem without requiring the cache index size to be strictly less than or equal to the page size?

    Question 7
    Level 1: Warm-up

    A byte-addressable system has a 24-bit physical address and uses a direct-mapped cache. Which of the following cache configurations is IMPOSSIBLE?

    Question 8
    Level 1: Warm-up

    A computer system has a two-level cache hierarchy (L1 and L2) and main memory. The L1 cache access time is 1 ns, and the L2 cache access time is 5 ns. The main memory access time is 50 ns. The L1 hit rate is 0.9, and the L2 local hit rate is 0.8. What is the average memory access time (AMAT) in nanoseconds?

    Question 9
    Level 1: Warm-up

    For a computer system with a 16-bit physical address, the address is divided into tag, index, and offset fields. If the block size is 16 bytes, what is the maximum possible number of index bits, assuming the tag field must be at least 1 bit?

    Question 10
    Level 1: Warm-up

    In a direct-mapped cache system, the specific cache line to which a main memory block is mapped is uniquely determined by which part of the memory address?

    Free preview ends here

    Login to view the complete short notes

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Cache Memory, Memory Hierarchy and Address Translation Short Notes for GATE CS

    Cache Memory, Memory Hierarchy and Address Translation short notes for GATE CS: 6 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    Quick Reference: Direct-Mapped Cache

    Essential Formulas

    Lines
    Index
    Offset
    Tag
    Key Points:
    • Direct-mapped: one block → one line
    • "Total tag storage" ≠ "tag bits"
    • Cache size ≤ main memory size

    Problem-Solving Checklist

    • Identify given information
    • Determine addressing mode (byte/word)
    • Calculate number of lines
    • Find index and offset bits
    • Calculate tag bits by subtraction
    • Verify: Tag + Index + Offset = Address

    Quick Reference: Set-Associative Cache

    Quick Reference

    Lines
    Sets
    Index
    Tag

    Problem-Solving Checklist

    • Identify given info
    • Determine forward/reverse
    • Calculate lines & sets
    • Find index & offset
    • Calculate tag or

    Conflict Misses — Quick Checklist

    Six-step checklist

    1. Word address? → multiply by word size in bytes.
    2. Find (block size) and (number of lines).
    3. Line = (address ÷ B) mod L for each address.
    4. Group addresses by line.
    5. Simulate or use shortcut: 1 address/line → 1 miss then hits; k addresses/line → every access misses.
    6. Sum hits and misses across all rounds.

    Remember: conflict miss = two different blocks, one line, alternating access. That is the whole game.

    Write Policies — Quick Reference

    Write policies

    • Write-through: write hit → update cache + memory
    • Write-back: write hit → update cache, set dirty bit

    Allocation policies

    • Write-allocate: write miss → load into cache, then write
    • No-write-allocate: write miss → write to memory, cache unchanged

    Replacement policies

    • LRU: evict least recently accessed
    • FIFO: evict oldest loaded
    • Random: evict any line randomly

    Remember: write-back needs dirty bit, write-through does not. Writebacks occur only in write-back on dirty eviction.

    Cache Memory, Memory Hierarchy and Address Translation: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Computer Organization and Architecture MCQ

    A processor uses 32-bit addresses and has a 128 KB, 8-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    1. A.

      15

    2. B.

      16

    3. C.

      20

    4. D.

      18

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: When block size is not given, use the cancellation trick — block size terms cancel out in the calculation. The Cancellation Trick: Step 1: Apply the formula. Tag = Tag = Tag = Tag = $18$ bits. Why this works: Index bits = Offset bits = Index + Offset = Tag = Address - (Index + Offset) = Address - Answer: 18 bits.
    Question 2 · Computer Organization and Architecture MCQ

    A processor uses 32-bit addresses and has a 32 KB, 4-way set-associative cache. The block size is not specified but is known to be a power of two. What is the number of bits in the tag field?

    1. A.

      17

    2. B.

      18

    3. C.

      19

    4. D.

      20

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: When block size is not given, use the cancellation trick — block size terms cancel out in the calculation. The Cancellation Trick: Step 1: Apply the formula. Tag = Tag = Tag = Tag = $19$ bits. Answer: 19 bits.
    Question 3 · Computer Organization and Architecture MCQ

    An urn contains 3 red and 2 black balls. A Polya Urn process is run for draws. For how many values of is the probability of drawing a red ball on the -th draw strictly greater than ?

    1. A.

      0

    2. B.

      1

    3. C.

      3

    4. D.

      5

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: The martingale property of the Polya Urn process.

    Step 1: The martingale property states that the expected proportion of red balls remains constant throughout the process.

    Step 2: Consequently, the probability of drawing a red ball at any specific step is exactly equal to the initial proportion of red balls.

    Step 3: Initial proportion = .

    Step 4: Since the probability is always exactly , it is never strictly greater than for any .

    Answer: 0.

    Question 4 · Computer Organization and Architecture MCQ

    In a Polya Urn process starting with 2 red and 3 black balls, what is the expected number of red balls drawn in 10 draws?

    1. A.

      2

    2. B.

      4

    3. C.

      5

    4. D.

      6

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: Linearity of expectation and the constant probability of drawing red.

    Step 1: The probability of drawing a red ball at any specific step is the initial proportion .

    Step 2: Here, .

    Step 3: Let be the indicator variable for drawing red on step . .

    Step 4: The total number of red balls drawn in draws is .

    Step 5: By linearity of expectation, .

    Answer: 4.

    Question 5 · Computer Organization and Architecture MCQ

    An urn initially contains 2 red and 8 black balls. A Polya Urn process is run. For how many values of is the expected proportion of red balls in the urn exactly ?

    1. A.

      1

    2. B.

      3

    3. C.

      4

    4. D.

      5

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: The martingale property of the Polya Urn process.

    Step 1: The martingale property states that the expected proportion of red balls after draws is exactly equal to the initial proportion.

    Step 2: Initial proportion = .

    Step 3: Therefore, for ANY number of draws , the expected proportion is exactly .

    Step 4: Since this holds for all , it holds for all 5 values in the set.

    Answer: 5.

    Question 6 · Computer Organization and Architecture MCQ

    Consider the following cache tagging strategies:

    1. VIVT (Virtual Index, Virtual Tag)
    2. PIPT (Physical Index, Physical Tag)
    3. VIPT (Virtual Index, Physical Tag)

    How many of these strategies inherently avoid the synonyms problem without requiring the cache index size to be strictly less than or equal to the page size?

    1. A.

      0

    2. B.

      1

    3. C.

      2

    4. D.

      3

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: Synonyms occur when different virtual addresses map to the same physical address but different cache indices.

    Step 1: VIVT uses virtual indices. Different VAs mapping to the same PA can have different indices, so it suffers from synonyms.

    Step 2: PIPT uses physical indices. Since the PA is the same, the index is the same. It inherently avoids synonyms without any size constraints.

    Step 3: VIPT uses virtual indices. It only avoids synonyms if the virtual index bits are a subset of the page offset bits (which are identical for the same PA). This requires the index size constraint.

    Step 4: Only PIPT (1 strategy) inherently avoids synonyms without the constraint.

    Answer: B

    Question 7 · Computer Organization and Architecture MSQ

    A byte-addressable system has a 24-bit physical address and uses a direct-mapped cache. Which of the following cache configurations is IMPOSSIBLE?

    1. A.

      Cache with 512 lines and 32-byte blocks, tag field is 12 bits

    2. B.

      Cache with 256 lines and 64-byte blocks, tag field is 11 bits

    3. C.

      Cache with 1024 lines and 16-byte blocks, tag field is 10 bits

    4. D.

      Cache with 128 lines and 128-byte blocks, tag field is 14 bits

    Correct Answer:

    ["B","C"]

    Step-by-Step Solution

    Key idea: This is a boundary analysis question. For each configuration, check if tag + index + offset = 24 bits.

    Step 1: Option A - 512 lines, 32-byte blocks, 12-bit tag

    • Offset = bits
    • Index = bits
    • Tag = 12 bits
    • Total = 12 + 9 + 5 = 26 bits ≠ 24. IMPOSSIBLE.

    Wait, let me recalculate. The question asks which is impossible, meaning which violates the constraint.

    Let me re-evaluate each option:

    Step 1: Option A - 512 lines, 32-byte blocks, 12-bit tag

    • Offset = bits
    • Index = bits
    • Tag = 12 bits
    • Total = 12 + 9 + 5 = 26 bits > 24. IMPOSSIBLE.

    Step 2: Option B - 256 lines, 64-byte blocks, 11-bit tag

    • Offset = bits
    • Index = bits
    • Tag = 11 bits
    • Total = 11 + 8 + 6 = 25 bits > 24. IMPOSSIBLE.

    Step 3: Option C - 1024 lines, 16-byte blocks, 10-bit tag

    • Offset = bits
    • Index = bits
    • Tag = 10 bits
    • Total = 10 + 10 + 4 = 24 bits = 24. POSSIBLE.

    Step 4: Option D - 128 lines, 128-byte blocks, 14-bit tag

    • Offset = bits
    • Index = bits
    • Tag = 14 bits
    • Total = 14 + 7 + 7 = 28 bits > 24. IMPOSSIBLE.

    Answer: A, B, D are impossible.

    Common trap: Students calculate only one component and forget to verify the sum equals 24 bits.

    Question 8 · Computer Organization and Architecture NAT

    A computer system has a two-level cache hierarchy (L1 and L2) and main memory. The L1 cache access time is 1 ns, and the L2 cache access time is 5 ns. The main memory access time is 50 ns. The L1 hit rate is 0.9, and the L2 local hit rate is 0.8. What is the average memory access time (AMAT) in nanoseconds?

    Correct Answer:

    2.50

    Step-by-Step Solution

    Key idea: This is a multi-level AMAT calculation where you must apply the hierarchical access formula.

    Step 1: Recall the AMAT formula for two-level cache.

    Step 2: Identify the given values.

    • ns
    • ns
    • ns

    Step 3: Substitute into the formula.

    ns

    Answer: 2.50

    Question 9 · Computer Organization and Architecture MCQ

    For a computer system with a 16-bit physical address, the address is divided into tag, index, and offset fields. If the block size is 16 bytes, what is the maximum possible number of index bits, assuming the tag field must be at least 1 bit?

    1. A.

      11

    2. B.

      12

    3. C.

      15

    4. D.

      16

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is an observation and boundary question, recognisable because it asks for a "maximum possible" value under a specific constraint (tag 1 bit).

    Step 1: Identify total address bits = 16.

    Step 2: Calculate offset bits. Block size = 16 bytes = bytes, so offset = 4 bits.

    Step 3: Apply the address decomposition formula: .

    Step 4: Substitute knowns: . This simplifies to .

    Step 5: To maximize the index, we must minimize the tag. The constraint states tag 1 bit. So, minimum tag = 1.

    Step 6: Maximum index = bits.

    Answer: 11 bits.

    Question 10 · Computer Organization and Architecture MCQ

    In a direct-mapped cache system, the specific cache line to which a main memory block is mapped is uniquely determined by which part of the memory address?

    1. A.

      Tag field

    2. B.

      Index field

    3. C.

      Offset field

    4. D.

      Valid bit

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a direct formula question, recognisable because it asks for the specific address field responsible for the cache line mapping.

    Step 1: Recall the address decomposition for a direct-mapped cache. The physical address is split into Tag, Index, and Offset.

    Step 2: The Index field directly selects the cache line. The mapping formula is , which is exactly what the Index bits represent.

    Step 3: The Tag identifies the block, the Offset identifies the byte, and the Valid bit is metadata, not part of the address mapping.

    Answer: The Index field.

    More short notes in this unit