Cache Memory Concept
- 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 Term | Real-life Analogy Mapping |
|---|---|
| CPU | Student reading notes. |
| Cache Memory | Study desk surface (small size, items accessed instantly). |
| RAM (Main Memory) | Bookshelf across the room (takes time to walk and fetch). |
| Hard Disk | Central 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
- 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).
D-A-S (Direct Associative Set)
Direct mapping, Associative mapping, Set-associative mapping
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.