CSC114 ยท 2075 ยท 5 marks
What is the purpose of cache memory? How sequential access differs from direct access?
What is the purpose of cache memory? How sequential access differs from direct access? [5]
Quick answer
Cache memory is a small, high-speed memory placed between the CPU and the main memory (RAM) in the memory hierarchy.
Cache Memory and Access Methods
Purpose of Cache Memory
Key Purposes:
-
Speed Bridging: The CPU operates much faster than RAM (CPU registers: 1-2 ns, RAM: ~60 ns). Cache memory (speed: 2-10 ns) bridges this speed gap so the CPU does not have to wait for data from the slower main memory.
-
Temporary Storage of Active Data: Cache holds the currently working data and instructions that the CPU is likely to need next, reducing the number of times the CPU must access the slower main memory.
-
Performance Improvement: By keeping frequently used data close to the CPU, cache memory significantly speeds up overall system performance.
Key Characteristics of Cache Memory:
- Speed: 2 to 10 nanoseconds
- Size: 32 KB to 4 MB
- Made of SRAM (Static RAM) which uses 4-6 transistors per cell, requires no refreshing, and is faster than DRAM
- Volatile memory (data is lost when power is off)
- Directly accessible by the CPU
Sequential Access vs. Direct Access
These are two different methods of accessing information stored in a file or storage device.
| Feature | Sequential Access | Direct Access |
|---|---|---|
| Definition | Data is accessed in a sequential order from start to end | Data can be accessed in any order, directly at any location |
| Order | Must read all preceding records before reaching the desired one | Can jump directly to the required record |
| Speed | Slower for retrieving a specific record | Faster for retrieving a specific record |
| Example | Reading a tape from beginning | Reading a specific block on a hard disk |
| Flexibility | Less flexible | More flexible |
Summary:
- Sequential access means the file is read from the beginning to the end in order; you cannot skip to a specific location without passing through all previous data.
- Direct access means any part of the file can be read or written at any time without going through the preceding data, making it much more efficient for random retrieval.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.