Computer Storage System (study notes)

Source: Internet
Author: User
Computer Storage System (learning excerpt) Liu Jianwen (http://blog.csdn.net/keminlau

)

Key: Memory Management virtual memory layering Management Philosophy


Layered Organization

The computer memory (storage) system is organized in a hierarchical structure, with high-speed but low-cost capacity at the top, low-speed but low-cost capacity at the bottom. Register heap, cache, main memory, and secondary memory, respectively from the top to the bottom ). Why is the memory system hierarchical? If the answer is efficiency, what is the principle of efficiency improvement? If the principle is the legendary principle of locality, how is it implemented? What is the impact on system developers and application developers (obviously, the memory system hierarchy is transparent to application developers and they do not feel the existence of hierarchy )?

High-speed cache

As a buffer from memory to CPU, the cache is used to store frequently used data blocks in the memory. The Hierarchical Storage System aims to increase the time when the CPU accesses data, so that the time can be as close as possible to the high-speed cache speed. The effect of this goal depends on three factors: first, the behavioral characteristics of the program itself; second, the capacity and organization of the high-speed cache; and third, cache replacement policy ). A Data Reference of the processor is called cache hits in the cache. Otherwise, it is called cache miss )". When a Miss occurs, (the system must first extract) the data that does not hit the cache. This action will load the entire block of data that does not hit the data into the high-speed cache (Kemin: How is the whole block method? Configured ?).

The high-speed cache organization method determines the CPU search cache method. Cache can be organized in three ways: direct mapped, fully associative, and set associative ). The direct ing method does not need to replace the algorithm. The latter two require some policies (FIFO, LRU, or other policies) to determine how to replace the data blocks that do not hit.

Virtual Memory

Another objective of Hierarchical Storage System is to use large external storage to expand the primary storage. This is the so-called virtual memory mechanism. The virtual memory allows us to run the program in a virtual address space with a relatively large actual memory. Another function of virtual memory is to implement multiple technologies to allow multiple processes to share memory resources. The cost of the virtual memory mechanism is that additional space is required to save management information (such as address ing programs and page tables), the time required for virtual address translation, and the processing time when pages are missing.

The relationship between the VM and the primary storage is similar to that between the primary storage and the cache. Due to the similarity, the cache and address translation buffer TLB (translation lookaside buffer) are often confusing. In fact, TLB is also a high-speed cache, a type of high-speed cache for specific purposes. We must be clear that a virtual address must be converted to a physical address before it can access the primary storage, which is the function of TLB. Although it is also a buffer, the function objectives of the high-speed cache and (page-based) primary storage are not the same, and the high-speed cache tends to increase the access speed, page-based primary storage (that is, virtual storage) is more about expanding the primary storage.

Thoughts

The hierarchical design of memory is based on the so-called "locality" of memory access, including temporal locality and spatial locality.

P.s. I realized that the objective existence of locality determines the hierarchical design of memory, not vice versa. In other words, locality is a general rule for the existence of things, while Memory Hierarchy Is only a special case.

P.s. This idea reminds me of the objective existence of other ideas. For example, implementing the concurrency mechanism is the idea of interruption ......

 

The central idea of the storage hierarchy is that each k is located at the K layer, and the faster and smaller storage devices are cached as larger and slower storage devices located at the K + 1 layer. In other words, each layer in the hierarchy caches data objects from the lower layer.

Management

For each layer in a hierarchy, some form of logical manage caching is required ). This logic includes how to divide the cache into blocks, how to access the cache, how to determine whether the cache hits, and how to replace the old data blocks with new data blocks. This logic can be implemented by a combination of hardware, software, or both.
For example, the register file is the highest level in the bit hierarchy. It is special that it is "managed" by the compiler, such as allocating registers to a variable. This "management" logic is software;

Another example is that the CPU's Level 1 (L1) and level 2 (L2) high-speed cache are completely managed by built-in hardware. The management logic is hardware;
In a system that implements virtual memory, the memory is used as the external memory cache. This virtual "cache" refers to the address conversion hardware (such as MMU) of the operating system software and CPU) "managed" together.

Another example is that in machines with distributed file systems (such as AFS), external storage is used as the "cache" of the entire distributed network database and is managed by the local AFS client ".

As a data user, such as an application developer, there is no need to care about the implementation of the cache. The cache mechanism is automatic and transparent to them, but for system administrators, for example, operating system developers must understand the implementation principles of these "management" functions.

Kemin: As a system developer, it is less likely to be exposed to hardware development, so you can have a basic understanding of CPU high-speed cache; however, system developers may be involved in compilation optimization, operating system transplantation, and other work. Therefore, the implementation of these two "management" functions must be mastered.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.