Computer OrganizationProgress: 0/1 completed
Subjects/Computer Organization

Cache Memory Concept

Medium
13 mins read
Prerequisites
  • Primary memory RAM structure
  • CPU register speed mappings

Introduction

CPU executes instructions extremely fast. Par main memory RAM slow speed me response leti hai. Is speed mismatch logic ko balance karne ke liye, CPU aur RAM ke beech ek fast static memory install hoti hai jise **Cache Memory** bolte hain.

Real-Life Analogy

💡 Student Study Desk Analogy

Accessing books speed optimization

Concept TermReal-life Analogy Mapping
CPUStudent reading notes.
Cache MemoryStudy desk surface (small size, items accessed instantly).
RAM (Main Memory)Bookshelf across the room (takes time to walk and fetch).
Hard DiskCentral public library (requires transport time to fetch items).

Detailed Concept Explanation

Cache works on the principle of **Locality of Reference**: 1. **Temporal Locality**: Access kiya hua data dynamic parameters close time frame execution repeat updates me reuse hoga. 2. **Spatial Locality**: Access data index blocks and neighboring registers data access trigger logic values. Cache Mapping Techniques: - **Direct Mapping**: RAM block maps to unique cache line indexes. - **Associative Mapping**: RAM block can map anywhere in cache lines. - **Set-Associative Mapping**: Hybrid mix mapping.

Visual Diagram

Newdisk pe program
ReadyRAM Ready Queue
Dispatch
RunningCPU execution
TerminatedExit / Finished
I/O Wait
Waiting / BlockedI/O or Event
I/O Done
Note: Ready state queue holds processes waiting for CPU scheduler assignment.
Important Point
  • Cache hit ratio (H) is the percentage of memory access requests solved directly in Cache.
  • Average Access Time: T_avg = H * T_c + (1 - H) * T_m (where T_c = Cache time, T_m = Main memory time).
Mnemonic / Memory Trick

D-A-S (Direct Associative Set)

Direct mapping, Associative mapping, Set-associative mapping

Mnemonic helper to remember cache indexing types.
Avoid This Common Mistake
Students cache mapping tag bits size and index bits block offsets formulas confusion coordinate values calculations mistake parameters trace correctly.
GATE Exam Insights
Numerical calculation of total tag memory requirements and set associative lines configurations are highly scoring domains in GATE.

Practice Mini Quiz

Revision Summary (One-Page Notes)

  • Cache sits between CPU and RAM.
  • Uses locality of reference.
  • Mapping methods: Direct, Associative, Set-Associative.
  • Speeds up total throughput.