×

What is Cache Memory? Types of Cache Memory

Cache Memory in Computer

Cache memory is a semiconductor chip used to retrieve data from a computer's memory efficiently. Generally, cache memory is much costlier than main memory or any other disk memory. The cache memory acts as a buffer between RAM and CPU. It is more readily available for the processor than the main memory in the form of DRAM.

Sometimes, it is also known as CPU memory because it is directly integrated into the CPU or placed on a chip directly connected with the CPU. It means that the cache memory is significantly closer to the processor. Due to this, the processor can easily access the Cache memory.

It is smaller than the main memory and has less storage space than the main memory. However, the speed of the Cache memory is very fast. The rate of the cache memory is somewhere 10 to 100 times faster than the main memory.

Cache memory and the cache is two different terms. The cache is generally temporary storage in the form of the hardware or the software. But cache memory is a special hardware component that permits the computer to create cache at different levels.

Types of Cache Memory

Cache memory is divided in terms of the level that describe the closeness and accessibility to the processor. It is generally divided into three levels which are the following:

Level1: This level is also known as the primary cache. It is quite small in size, but it is extremely fast. It is generally integrated into the processor chip in the form of a CPU cache.

Level2: This level is also known as the secondary cache. Level 2 cache memory is bigger than Level1 in size. It may be integrated on a separate chip or coprocessor. It has a high-speed system bus, which is directly connected to the CPU. Due to this, it does not get slowed by the traffic on the main system bus.

Level3: It is the special memory that is developed to enhance the performance of Level1 and Level2. Level1 or Level2 can be significantly faster than Level3. However, the speed of Level3 is generally double the speed of DRAM. In the multi-core processor, each core has its individual Level1 and Level2 cache but can share Level3 cache.

Cache Performance:

The processor, before anything to read or write a location in the main memory, first check the following entry in the cache:

  • Whenever the processor finds that there is a memory location present in the cache, the cache hit will occur, and data will be accessible from the cache.
  • The cache miss will have occurred when the processor does not find the cache's memory location after validation. The cache will allocate a new entry and copies the data from the main memory for every cache miss. After this, the request is fulfilled from the contents of the cache.

Hit ratio: The hit ratio is the measurement quantity used to measure the cache memory's performance.  

Hit ratio = hit / (hit + miss) =  no. of hits/total accesses

The performance of the cache can be enhanced by using the following things:

  • The size of the block should be larger.
  • The associativity should be higher.
  • The miss rate should be less.
  • Avoid miss penalty
  • The time to hit the cache should be less.

Cache Mapping

The various cache memory mapping techniques are available below:

  • Direct mapping
  • Associative mapping
  • Set-Associative mapping.

1) Direct Mapping: It is the basic mapping technique. In this mapping technique, each block is mapped to only one cache memory location. In this mapping technique, each memory block has been assigned to a distinct line in the cache. If the line is previously taken up by any memory block when a new block needs to be loaded, the old block will be flogged. Address space will be divided into two parts: an index field and a tag field. The tag field is stored in the cache, and the main memory holds all the things that have been left. If the Hit ratio is good, the performance of this technique will be good. We can say that this mapping technique's performance directly depends on the Hit ratio.

2) Associative Mapping: In the associative mapping technique, associative memory is used to store content and addresses of the memory word. In this mapping technique, any block can occupy any line of the cache. Thus, the word id's bits are used to identify which word in the block is needed, but the tag becomes all of the remaining bits. It allows placing any word anywhere in the cache memory. It is the fastest and the most flexible mapping form.

3) Set-associative Mapping: The Set-associative Mapping technique can be viewed as the agreement between the previous two types of cache memory mapping technique. This mapping technique maps each block in the subset of the location of the cache. It is sometimes also known as the "N-way set associative mapping." It will permit a cache of any "N" location from the Level 1 cache in the main memory. The best of the direct cache mapping technique and associative cache mapping technique are grouped to form the set-associative cache mapping technique.


Related Topics

What does Alt+D do?

Computer keyboard shortcut keys play an important role in the working of any computer user. We can do anything from the mouse and keyboard, but shortcut keys provide data in...

3 minutes read.

When I click my mouse, it sometimes double-clicks?

You may have noticed that occasionally, despite just pressing the mouse button once, your mouse will "double-click" an icon or the pointer. By following the steps below, you may review...

4 minutes read.

What is BIOS?

BIOS stands for Basic Input/Output System. It is firmware that controls the basic functions of a computer, such as booting the system and communicating with the hardware. It is stored...

7 minutes read.

How to fix boot error "PXE-E61" Media Test failure

If your laptop or desktop computer won't start and displays the following message: PXE-E61: Media test failure, check cable Or PXE-M0F: Exiting PXE ROM Your BIOS settings may be incorrect, or your hard disc could...

3 minutes read.

How to log out of your operating system

Whenever you use an application or software or an operating system, you have to log in to that particular system. As soon as you log in, a period called a...

4 minutes read.

What is Video Card?

It is a component in the personal computer that is used to connect with the motherboard in the CPU. It is also called the graphic card or video control; as...

13 minutes read.

Why has my IP address changed

IP Address: Internet Protocol address, in short form, is known as IP address. This address could pose security liability, and these addresses are building blocks of the internet. IP addresses...

6 minutes read.

What is a Raster?

A horizontal scan line is an image made of lines on the interior of the screen that were traced by an electron beam to generate a raster. These lines can...

3 minutes read.

How much do Computer Programmers make?

With growing technology, people are working fast to pace up with the perpetual demand. Everything which has made our life easier and comfortable has something to do with computer engineering...

7 minutes read.

My computer is running slow, what steps can i do to fix it?

It’s your time to work on your computer, and it just remains hanged, not letting you switch to other programs; in other words, your computer is in a state of...

4 minutes read.

What is accessibility

Accessibility means that website, tools and Technologies are designed and developed so that people with disabilities can use them. We usually relate accessibility with persons with disabilities, but keeping websites...

6 minutes read.

What is an Online Service?

An entity that offers online access to various types of data for diverse purposes is known as an online service. Online banking, education, news, shopping, dating, computer support websites, social networking...

3 minutes read.

What is Procedural language?

A procedural language is a PC programming language with many capacities, guidelines, and explanations that should be executed in a specific request to achieve a task or program. As a...

10 minutes read.

What is an App Drawer?

An App Drawer is a dedicated section responsible for keeping a record of all the applications installed on your mobile phones or tablets. An app drawer consists of two words:...

7 minutes read.

Where can I ask questions on the internet?

The internet is a great resource of knowledge and information where you can find all types of questions like imaginable questions, past answers, and much more. However, there are times...

6 minutes read.

What is a Taskbar?

A taskbar is a graphical user interface component that serves several functions. Usually, a list of the running apps is displayed on it. The taskbar's arrangement and specific appearance vary...

4 minutes read.

What is AR lens?

The full form of AR is the anti-reflective lens. AR is a type of optical coating that is applied to the plain of the lenses and other optical elements to...

6 minutes read.

Are smartphones and tablets computers

The answer is yes. In modern times, at least a laptop /tablet /desktop /smartphone will be in a home. Because they play an important and vital role in everyone’s life...

4 minutes read.

Why am I unable to increase the resolution in Windows?

If you cannot raise the display resolution in Windows, take these actions. Identifying and resolving video driver issues If Windows doesn't let you raise the screen resolution, your video drivers can be...

3 minutes read.

How to choose which items show in the notification area

Icons in the notification area, also known as the system tray, contain information for users about several features of their operating system. Examples include the date and time, the state...

3 minutes read.