/ / What is cached data and caching?

What is cached data and caching?

The computer, alas, does not instantly execute commandswhich receives from people. To speed up this process, a number of tricks are used, and the place of honor among them belongs to caching. What it is? What is cached data? How does this process actually happen? What is cached data in a Samsung smartphone, for example, and do they differ in some way from that in a computer? Let's start getting answers to these questions.

What is a cache?

what is cached data
Так называют промежуточный буфер, который provides quick access to information, the probability of which is the highest request. All data is contained in it. An important advantage is that you can extract all the necessary information from the cache much faster than from the original storage. But there is a significant drawback - size. Cached data is used in browsers, hard drives, CPUs, web servers, WINS, and DNS. The basis of the structure are record sets. Each of them is associated with a specific element or block of data that acts as a copy of what is in the main memory. Entries have an identifier (tag) with which the correspondence is determined. Let's look from a slightly different point of view: what is the cached data on a Samsung phone or another manufacturer? Are they different from those created in the computer? From a fundamental point of view - no, the difference is only in size.

Process of use

what is cached data on android
When the client (they were listed above)asks for data, the first thing a computer does is examine the cache. If it contains the necessary entry, then it is used. In these cases, hit occurs. Periodically, data from the cache is copied to main memory. But if the necessary record was not found, then the content search in the basic storage is performed. All information taken is transferred to the cache so that it can then be accessed more quickly. The percentage when requests are crowned with success is called the level or hit rate.

Data update

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, in case of a miss, a decision is made to discard some of the information in order to free up space. To decide what will be replaced, use different algorithms for crowding out. By the way, if we talk about what is cached data on the "Android", then for the most part they are used to work with pictures and application data.

Write policy

What is cached data in the Samsung smartphone
During the modification of the contents of the cache, the data in the main memory is also updated. The time delay that passes between the entry of information depends on the recording policy. There are two main types:

  1. Immediate recording. Each change is synchronously recorded in the main memory.
  2. Delayed or write back.Data is updated periodically or upon request from the client. To keep track of whether a change has been made, use a sign with two states: "dirty" or changed. In case of a miss, two calls can be made to the main memory: the first is used to write data that has been changed from the cache, and the second is to read the necessary element.

Может быть и такое, что информация в intermediate buffer becomes irrelevant. This happens when data changes in the main memory without making adjustments to the cache. For coherence of all editing processes, coherence protocols are used.

Modern challenges

What is cached data in the memory of the smartphone
С увеличением частотности процессоров и Improving the performance of RAM has a new problem area - the limitations of the data interface. What can a knowledgeable person notice of this? Cache memory is very useful if the frequency in RAM is less than in the processor. Many of them have their own intermediate buffer to reduce the access time to RAM, which is slower than the registers. CPUs that support virtual addressing often place a small but very fast buffer of address translation. But in other cases, the cache is not very useful, and sometimes only creates problems (but this is usually in computers that have been modified by a non-professional). By the way, speaking of what cached data is in the memory of a smartphone, it should be noted that due to the small size of the device, it is necessary to create new miniature cache implementations. Now, some phones can boast parameters, like those of advanced computers ten years ago - and what's the difference in their size!

Synchronize data between different buffers

The cache is useful when one, and how to maintain the effectiveness of this technology, if they are many? This problem is solved by buffer coherence. There are three options for data exchange:

  1. Inclusive. Cache can behave as you like.
  2. Exclusive. Developed for each case.
  3. Non-exclusive The standard is widespread.

Caching levels

what is cached data in the smartphone
Their number is usually three or four. The greater the level of memory, so it is more voluminous and slower:

  1. L1 cache. The fastest cache level is first.In fact, it is part of the processor, since it is located on one chip and belongs to functional blocks. Usually divided into two types: instruction and data cache. Most modern processors without this level do not work. This cache operates on the processor frequency, so it can be accessed every clock cycle.
  2. L2 cache.Usually located together with the previous one. It is a separate memory. To find out its size, it is necessary to divide the entire volume used for caching data by the number of cores in the processor.
  3. L3 cache. Slow, but the largest dependent cache. Usually more than 24 MB. Used to synchronize data that comes from various second-level caches.
  4. L4 cache.Use is justified only for high-performance multiprocessor mainframes and servers. It is implemented as a separate chip. If you ask a question about what data caching is in the Samsung smartphone and you are looking for this level in it - I can say that for 5 years you are definitely in a hurry.

Cache associativity

This is a fundamental characteristic.Associativity of cached data is necessary to display logical segmentation. It, in turn, is necessary due to the fact that sequential enumeration of all available lines takes dozens of cycles and reduces all advantages. Therefore, a tight binding of the RAM cells to the cache data is used to shorten the search time. If we compare intermediate buffers, which have the same volume, but different associativity, then the one for whom it is large, will work less quickly, but with significant specific efficiency.

Conclusion

What is cached data in the Samsung phone
As you can see, cached data at certainconditions allows your computer to act more quickly. But, alas, there are still quite a few aspects that can be worked on for a long time.