- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Cache is a type of memory that is used to increase the speed of data access. Normally, the data required for any process resides in the main memory. However, it is transferred to the cache memory temporarily if it is used frequently enough.
A diagram to better understand the data transfer in cache management is as follows −
The cache performance can be explained using the following steps −
- If a process needs some data, it first searches in the cache memory. If the data is available in the cache, this is termed as a cache hit and the data is accessed as required.
- If the data is not in the cache then it is termed as a cache miss. Then the data is obtained from the main memory. After that the data is transferred to the cache memory under the assumption that it will be needed again.
- The performance of the cache is measured using the hit ratio. It is the number of cache hits divided by the total cache accesses. The formula for this is:
Types of Cache Memory
There are mainly two types of cache memory i.e. primary cache and secondary cache. These are explained in detail as follows −
Primary cache is very fast and its access time is similar to the processor registers. This is because it is built onto the processor chip. However because of this reason, its size is quite small. It is also known as a level 1 cache and is build using static RAM (SRAM).
The secondary cache or external cache is cache memory that is external to the primary cache. It is located between the primary cache and the main memory. It is also known as a level 2 cache and is often housed on the processor chip as well.
Advantages of Cache Memory
Some of the advantages of cache memory are as follows −
- Cache memory is faster than main memory as it is located on the processor chip itself. Its speed is comparable to the processor registers and so frequently required data is stored in the cache memory.
- The memory access time is considerably less for cache memory as it is quite fast. This leads to faster execution of any process.
- The cache memory can store data temporarily as long as it is frequently required. After the use of any data has ended, it can be removed from the cache and replaced by new data from the main memory.
Disadvantages of Cache Memory
Some of the disadvantages of cache memory are as follows −
- Since the cache memory is quite fast, it is extremely useful in any computer system. However, it is also quite expensive and so is used judiciously.
- The cache is memory expensive as observed from the previous point. Also, it is located directly on the processor chip. Because of these reasons, it has a limited capacity and is much smaller than main memory.
- Basic Commands of APT-GET and APT-CACHE for Package Management
- What is Cache Memory? (Functions and Types of Cache Memory)
- Difference Between First level cache and Second level cache in Hibernate
- LFU Cache in Python
- HTML5 applicationCache vs Browser Cache
- Difference between Cache and RAM
- Difference Between Cache and Cookies
- cURL Command Without Using Cache
- Counting Cache Misses in Data Structure
- Using Redis Cache with Spring Boot
- Construction Management vs. Project Management
- Supply Chain Management vs. Operations Management
- Risk Management Strategies in Project Management
- Difference between Cache Memory and Virtual Memory
- Difference between Virtual memory and Cache memory