- 2073 Chaitra · 8 marks
Memory characteristics and LRU replacement
Short answer
Memory characteristics: location, capacity, unit of transfer, access method, performance, physical type, volatility, and organization. LRU replacement evicts the block unused for the longest time by tracking usage order. In a 4-block cache with accesses 2,3,2,1,5,2,4,5,3,2,5,2, hits=6, misses=6, hit ratio=0.5.
Explain the major characteristics of memory. Explain the LRU (Least Recently Used) replacement policy with example.
Characteristics of memory
| Characteristic | Meaning | Examples |
|---|---|---|
| Location | Where the memory is: internal (registers, cache, main memory), external (disk, tape) | CPU registers, RAM, HDD |
| Capacity | Size: words or bytes for internal, bytes for external | 8 GB RAM, 1 TB disk |
| Unit of transfer | Data moved in one access: word for internal, block for external | Word, block, record |
| Access method | Sequential (tape), direct (disk), random (RAM), associative (cache tag search) | Tape, disk, RAM, cache |
| Performance | Access time (latency), memory cycle time, transfer rate = 1 / cycle time | DRAM access: tens of ns |
| Physical type | Semiconductor, magnetic, optical, magneto-optical | RAM, HDD, CD |
| Physical characteristics | Volatile or non-volatile; erasable or non-erasable | RAM volatile, ROM non-volatile |
| Organisation | Physical arrangement of bits into words | Interleaved memory banks |
LRU replacement policy
LRU (Least Recently Used) replaces the cache block that has not been used for the longest time. It uses temporal locality: a block used recently is likely to be used again soon. The hardware keeps an age (or use) counter for each line; on each access the age of the used line is reset and others are increased.
- Hit: the block is in the cache; no replacement. The block becomes the most recently used.
- Miss with free line: the block is loaded into a free line and becomes the most recently used.
- Miss with cache full: the least recently used block is removed and the new block is loaded.
Example: cache of 4 blocks, reference string 2, 3, 2, 1, 5, 2, 4, 5, 3, 2, 5, 2
Ref Result Cache (most recent first)
2 Miss [2]
3 Miss [3, 2]
2 Hit [2, 3]
1 Miss [1, 2, 3]
5 Miss [5, 1, 2, 3]
2 Hit [2, 5, 1, 3]
4 Miss (evict 3) [4, 2, 5, 1]
5 Hit [5, 4, 2, 1]
3 Miss (evict 1) [3, 5, 4, 2]
2 Hit [2, 3, 5, 4]
5 Hit [5, 2, 3, 4]
2 Hit [2, 5, 3, 4]
Hits = 6, misses = 6, hit ratio = 6/12 = 0.50. When 4 was referenced the cache was full and the least recently used block was 3, so 3 was evicted; when 3 came back, block 1 was the least recently used, so 1 was evicted.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- LRU replacement with hit and miss · Computer Organization and Architecture, chapter 6
- Direct mapping with 32-block memory, 10 blocks used · Computer Organization and Architecture, chapter 6 · asked 3×
- Direct mapping with 64-block memory, 10 blocks used · Computer Organization and Architecture, chapter 6 · asked 3×
- Characteristics of memory · Computer Organization and Architecture, chapter 6 · asked 4×
- Cache write policy techniques · Computer Organization and Architecture, chapter 6
- Mapping function and replacement algorithm · Computer Organization and Architecture, chapter 6
- Cache write policy and replacement algorithm · Embedded System, chapter 4
- Major characteristics of Bluetooth · Instrumentation II, chapter 5
- Page faults: FIFO, Optimal, LFU, LRU · Operating System, chapter 4 · asked 2×
- Page faults with 3 frames: LRU, FIFO, OPT · Operating System, chapter 4 · asked 2×
All Computer Organization and Architecture chapter 6 questions →