What is CPU cache?

A CPU cache is a memory inside the processor that is even faster than RAM in terms of performance speed. In this article, we will investigate this issue and see what CPU cache is and its uses.

What is CPU cache?

A CPU cache is one of the main criteria for the speed and power of any processor. In the rest of this article, we intend to deal with this issue in a specialized and technical way.

At the beginning of the construction of computers and their entry into the market and widespread use, the architecture of single-core processors and several megabytes of RAM was very popular. Processing without graphics and small volume was easily done with this category of computers. But the progress of computers and the need for more voluminous and heavier processing caused the game’s rules to change drastically.

The first step to increasing the processing speed was to increase the amount of RAM. With the increase in the amount of RAM, more information was available to the processors for processing, and the processing speed was much higher. But the speed did not increase much. Here the designers invented the multi-core design of the processor. The increase in the number of cores caused the processing power to increase, but this required software changes in operating systems and the field of software.

After multi-core technology, thread technology emerged. Thread technology doubled the speed of processor cores. This increase in speed caused the processors to perform their processes with more and better power, but this increase in speed also had other needs.

The first thing that the researchers faced was that they had to invent an operating system and software that would work well with a multi-core and threaded system. This required changes in programming paradigms. After that, a more serious problem arose. Although the speed of the processors increased, the RAM bus (the number of transactions between the RAM and the processor) did not increase that much (or, in better words, it was impossible to increase it due to structural limitations). There were many limitations and obstacles in the way designers solved this problem.

The most important problem in developing exchange speed was the exchange structures. Increasing bandwidth, optimal frequency use, and better conductors were all solutions that experts used to increase the speed of RAM and processor exchange. But again, the problem was not solved optimally.

It was here that CPU cache was presented as a final solution.

The CPU cache allows the processor to retrieve and process information quickly. This work played a huge role in increasing the speed of processors, especially multi-core processors. It can be said that its application was even better than the multi-core system because many software was designed in such a way that they could not use the parallel processing power of the processors. Still, their processing is much better with the CPU cache, and It was done faster.

The question is what CPU cache is and how it increases processing speed.

When the computer’s CPU is busy processing information, it must do this in three stages. First, it must call the data from memory (RAM or hard drive or its cache), decode them, and return the result to the memory after processing. These three steps are done consecutively and constantly in the processor. The processor has no memory, so it needs constant exchange with RAM or other memories to receive information.

In theory, the information in RAM is always ready to be fetched and immediately available to the processor, but structural problems prevent this fetching from being done quickly. Therefore, better architecture should be used. Here we can use an in-processor cache. The cache inside the processor eliminates the fetching time and allows the processor to read and execute information from the requested addresses immediately and when needed.

So, the reason for the existence of the CPU cache greatly reduces the time it takes the processor to access the desired information and data.

In the first series of CPU cache, it was offered only on one level and with a capacity of 56 KB on Intel processors. But this capacity increased with the increase in cores and thread processing capability. After some time, a new problem faced the designers of the processors.

The capacity of the single-level CPU cache was quickly filled, and more space was needed. But the problem was not only space; here, the addressing had to be done faster. After some research, a two-level model for CPU cache was presented.

In the two-level mode, a certain amount of information is entered into the second-level cache. The part fetched by the processors enters the first-level CPU cache and is processed. If more addresses are needed, the address request is sent to the second-level cache, and if there is no data or the desired address, the request is sent to RAM.

Using a two-level architecture for the CPU cache made processors work faster and improved the use of multi-level processing. At this time, the development of semiconductor materials made the cache capacity of two-level CPUs reach 128 KB in the first level and 2 to 8 MB in the second level.

Increasing the level of caches made it possible to develop cores further. With the smaller transistors in processors, it became possible to use more cores in one processor, and it was natural that this meant more need for faster memories, which resulted in the third-level cache.

The working order of the third level of the CPU cache is not different from the two-level model, and the only difference is the increase of the volume of this third-level cache up to 128 MB. Here too, part of the information enters the third-level CPU cache. Then according to the processor’s processing, the information from it enters the second and first levels of the CPU cache. After processing, it leaves it and goes to the RAM. This is especially useful when the number of cores of a processor is high.

In recent years, the CPU cache has increased capacity at all three levels. Current level caches up to one megabyte, level two up to 16 megabytes, and level three caches up to 128 megabytes of space available to processors. This allows processes such as virtualization, complex calculations, etc., to be easily performed in crowded networks, and processors continue to work without problems.

Does more processor cache mean faster processor speed?

As mentioned in the previous articles, you cannot increase your computer’s or server’s speed by increasing a single factor. The speed of your computer or processor depends on various factors. For example, if the software you are working with cannot do parallel processing or the rest of your hardware cannot exchange enough information with the processor (limitation of channels, bandwidth, or low buses), then you will not. You can use them optimally. This can cause the speed of your computer or server to slow down, and as a result, your server will work hard.

What is meant by Cache Miss and Cache Hit in CPU cache?

As mentioned above, when the processor is busy processing, it receives its retrieval information from the first-level cache. If there is no necessary information or address, it goes to the second-level cache. The path refers to the third cache. This search order is always done quickly.

If, in this search, the processor can find the necessary information in the CPU cache, then a Cache Hit (information access) occurs. A Cache Miss occurs if this information is not found in the CPU cache. ) it happens.

Cache miss can happen for various reasons; software incompatibility with new processing systems or problems in the addressing system is among the things that cause a cache miss.

Why don’t they make RAM like processor cache?

They make it, but the problem is not in the RAM. It is in the relationship between the RAM and the processor. The same techniques used to make RAM are also used in the CPU cache, but the problem here is that to access the RAM information, and a small distance must be traveled between the RAM slot and the processor core. A few tens of thousandths of a second may not seem like a lot of time, but when you think about the fact that 2.7 billion processes are performed on the processor every second, you can understand what a big difference this small amount can make.

Another reason why CPU cache is used is that CPU caches give the processor cores the opportunity to transfer processed information to RAM at a reliable speed and then send it to the desired section.

One of the developments that have occurred in recent years is to enlarge the processor space and increase the cache space. As mentioned above, the processor cache has increased from 28 KB to 128 MB in three levels. But this is not the end of the story. Ideas are now being considered to remove RAMs and merge them completely.

On the other hand, methods such as quantum processing have also achieved very good results. In the field of firewalls, we have seen significant progress. The combination of technology, innovation, and market needs is changing much from the usual practices. Now and at the time of writing this article (autumn 1998), Google has unveiled its quantum computer with incredible processing power. Sophos uses powerful processors in its firewalls, and HP offers RAMs. It talks about 512 GB capacity and more. Maybe this article will soon become a part of the history of the development of computers..!!

Frequently Asked Questions

What is CPU cache?

CPU Cache is an extremely fast memory located inside the processor and greatly increases the speed of processes. Normally, these caches are offered in three levels. The third level has the highest amount of memory.

Does more CPU cache mean faster computer speed?

Not necessarily, but by increasing the number of cache memories in the processors, the processing speed of the cores increases. But increasing the computer’s speed is a multifaceted puzzle that does not change much simply by increasing one element.

What is meant by Cache Miss and Cache Hit?

When the processor can find the address of the desired information in one of the cache levels, a cache hit occurs. Otherwise, the cache hit mode occurs.

Why work on CPU cache instead of RAM expansion?

The main problem here is the exchange of information between the RAM and the processor. Even with the most optimal mode, the duration of this exchange is still long. But caches inside the processor can quickly provide information to the processor – especially when the processor is multi-core. For this reason, increasing the size of the CPU cache is at the top of the development of processors. However, the development of RAM size and capacity is continuing.