Skip to content
Janvi Talreja edited this page Dec 29, 2022 · 5 revisions

Cache

Problem Statement

Certain data needs to be fetched very frequently and getting it from the main memory is quite slower. It gets expensive to hit the main memory again and again for the same data. This data if temporarily available in some block that is quick to access would make fetching the data faster.

Variety of Use Cases

Use Cases

  1. Cache speeds up data retrieval.
  2. Cache also acts as temporary storage.
  3. The cache also allows you to work on certain apps even when you're offline. Ex: Google docs.

Some apps do require an Internet connection to run but using the local cache in the browser we can still work on them and sync the data when the Internet connection is restored.

Features and Properties

  1. The size of the cache has to be small or rather correct based on the application. It has to be small in order to be close to the processor.
  2. It has less storage space and is more expensive than the main memory. What it sacrifices in size and price, it makes up for in speed.
  3. The actual hardware that is used for the cache is SRAM (Static Random Access Memory). SRAM is volatile memory, data is lost when power is removed.

NOTE: SRAM is the cache, and DRAM is the main memory.

Constraints and Limitations

  1. The memory size has to be smaller, it is a tradeoff between size and speed.
  2. The storage capacity is completely in use.
  3. It is volatile memory. In context with computer.
  4. Very expensive, so adding more cache leads to higher costs for the system.

Outcome

Cache though expensive, and less in size is quite useful for the quick retrieval of data.

NOTES:

  1. The idea of cache memory was developed by Maurice Wilkes in 1965.
  2. There are multiple types of cache - hardware(CPU caches, GPU caches), software(web cache).

Clone this wiki locally