What is cached data and caching?
The computer, alas, does not immediately execute commands,which receives from people. To speed up this process, a number of tricks are used, and an honorable place among them belongs to caching. What it is? What are the cached data? How does this process actually happen? What is the cached data in the Samsung smartphone, for example, and they differ from something that is in the computer? Let's get to the answers to these questions.
What is a cache?
Process of use
Updating the data
When using, say, a web browsera local cache is checked to find a copy of the page. Given the limitations of this type of memory, when a miss occurs, it is decided to discard some information to free space. To solve what exactly will be replaced, various wipe algorithms are used. By the way, if we talk about what cached data is on Android, then in mass they are used to work with pictures and application data.
- Immediate recording. Each change is synchronously stored in the main memory.
- Deferred or reverse recording. Updating the data is carried out periodically or upon request from the client. To track whether a change was made, use a symptom with two states: "dirty" or changed. In case of a miss, two calls directed to the main memory can be made: the first is used to write down data that has been changed from the cache, and the second is to read the required item.
It may also be that the information in thethe intermediate buffer becomes irrelevant. This happens when you change the data in the main memory without making any adjustments to the cache. For the consistency of all editing processes, coherence protocols are used.
Synchronization of data between different buffers
The cache is useful when there is one, but how to maintain the effectiveness of this technology, if there are many? This problem is solved by the coherence of the buffer. There are three options for data exchange:
- Inclusive. The cache can behave as you like.
- Exclusive. Developed for each specific case.
- Non-Exclusive. The standard of wide distribution.
Levels of caching
- L1 cache. The fastest level of the cache is the first. In fact, it is part of the processor, because it is located on the same chip and belongs to the functional blocks. It is usually divided into two types: a cache of instructions and data. Most modern processors without this level do not work. This cache functions on the processor frequency, so every cycle can access it.
- L2 cache. Usually it is located together with the previous one. It is a memory of separate use. To find out its value, it is necessary to divide all the volume given for data caching into the number of cores that is in the processor.
- L3 cache. Slow, but the biggest dependent cache. Usually more than 24 MB. Used to synchronize data that comes from different L2 caches.
- L4 cache. The use is justified only for high-performance multiprocessor mainframes and servers. It is implemented as a separate microcircuit. If you ask a question about what data caching is in a Samsung smartphone and look for this level in it, I can say that for 5 years you just hurried.
This is a fundamental characteristic. The associativity of cached data is necessary for mapping logical segmentation. It, in turn, is necessary because the sequential search of all available lines takes dozens of cycles and reduces all advantages to it. Therefore, a rigid binding of RAM cells to the cache data is used, to shorten the search time. If we compare the intermediate buffers, which have the same volume, but different associativity, then the one with the larger one will work less quickly, but with significant specific efficiency.