Talking about the physical memory of the storage model in the computer

Are the friends curious, how is the data stored in the computer's memory? What is the model of physical memory in a computer? I will give you a detailed introduction today.
Before we understand the storage model, we should first understand the storage system of the computer.
Personal knowledge of this part of the knowledge should first abstract the storage system in mind, because whether the disk, physical memory or virtual memory are connected to each other, abstracting the model helps us understand and remember. Then what part of the knowledge is needed or which part of the knowledge is going deeper, look for it from the system diagram.
It is recommended not to lengthen the front line in this knowledge, and look forward to forgetting the back.

Computer storage system diagram
Briefly above:
From the beginning of the process, we know that the process runs in memory, each process has its own independent memory address space, the purpose is to use memory safely and efficiently, the address space of a process is abstracted, belongs to virtual memory, and the memory is divided into Virtual memory and physical memory.
From physical memory analysis, physical memory management is divided into equal-length and unequal-length partitions. The equal-length partitioning generally records the structure through bitmaps, and the unequal-length partitions are generally recorded through the free-area table.
The physical memory needs to be algorithmically distributed to recycle the process. There are four kinds of allocation algorithms. The recovery algorithm is divided into four cases, and memory allocation and recycling cause memory fragmentation. The memory fragmentation problem is divided into internal and external fragments. The solution has compression technology.
From virtual memory analysis, it is divided into page/segment/segment page type memory management, and the physical to virtual memory is converted by page table/segment table/segment page table in the middle. The focus is on page management, which is important in page management. The concept of page table items, multi-level page table, inverted page table, MMU, fast table TLB and page fault / page fault exception, and the core concept of virtual storage technology is to put the temporarily unused pages (memory blocks) in memory On the disk, the question is which pages (memory blocks) are placed on the disk, so we introduce a page replacement algorithm, in which OPT is an ideal replacement algorithm, the basic algorithm has FIFO, FIFO improved second chance algorithm and clock algorithm, The aging algorithm and NRU in the LRU, since some pages are temporarily stored on the disk, then the disk is talked about.
Disks are hardware, so discuss its structure, how to access data, and some algorithms for disk scheduling. In addition, two other important technologies for virtual memory are memory mapping and copy-on-write.
Physical memory
Physical memory is actually the actual memory size of our machine. For example, my laptop's memory is 4G. We all know that the program is to be loaded into the memory to execute, so the larger the physical memory, the better the performance of our computer.
bitmap
A bitmap is actually a bit to mark data.
In equal-length memory management, for example, we divide the memory into memory blocks of the same size, then one bit is marked because it will form a bitmap.


In this way, we need a large block, just need to match the number of consecutive 0 in the bitmap.
Free area table
In unequal length partitioning, for example, we allocate memory according to the size of the process, which requires the use of a free area table to store free memory.


The free area linked list simply organizes the data in the free area table through a chain structure.
Memory allocation algorithm
The above describes how we organize unallocated memory through the data structure. Let's take the free area linked list structure as an example. Let's talk about the physical memory allocation algorithm.
1. First adaptation algorithm
The first adaptation algorithm is to find the block that meets the application memory size from the beginning in the free area list until the condition is met. The algorithm continuously tests the application from the beginning, so most of the content is low address space. The high address space flows out to meet the large application requirements, but the disadvantage is that frequent application and release in the lower address space leads to memory fragmentation in the low address space, and each time the search is started from the beginning, the search efficiency is relatively low. .
2. Next adaptation algorithm
The next adaptation algorithm is an improvement of the first adaptation algorithm. It starts looking down from the last adaptation. It doesn't need to start from scratch every time. This algorithm makes the memory use even, but it won't have big Memory blocks to satisfy memory allocation.
3. The most jia adaptation algorithm
This algorithm first sorts the size of the free area of ​​the memory block from small to large. After sorting, it matches every time from the beginning, so the matching result is definitely the most, but actually because it is more suitable for the size of the applied memory, there will be many comparisons. Small memory fragments are unusable and reordered after each allocation, which is expensive.
4. Worst adaptation algorithm
This algorithm sorts according to the free area of ​​the memory block from large to small. After sorting, when a process applies for memory, it allocates the largest memory block of the header to it, so if it cannot be allocated, all cannot be allocated, and the large memory is allocated to It can also be used for secondary allocation if it only takes up a small portion.
Memory recycling algorithm
After the memory is allocated and the process is used up, we need to recycle. In general, the memory recycling algorithm and the memory allocation algorithm are closely related.
So let's just look at the four situations in which the memory reclamation algorithm might appear.


The upper left is adjacent, the lower right is adjacent, the lower left is adjacent to the upper and lower, and the lower right is not adjacent to the upper and lower.
Memory fragmentation
What is memory fragmentation is the memory that occupies a certain amount of space in memory but cannot be utilized. Memory fragments are divided into internal and external fragments.
Internal fragmentation: For example, the same length is allocated by page. If there is a process that requires more than 5 pages of memory, then we can only allocate 6 pages of memory to it. Then the sixth page is not used up, except for some data. We are still free to be occupied by the process, and other processes cannot be used.
Outer Fragments: Outer Fragments are undivided, small blocks of memory that are not occupied by the process and are re-allocated because they are too small or otherwise not satisfied.
Tightening technology: We generally use austerity technology to merge small memory fragments. The principle is to separate the moving parts of the process that are not running safely from the memory fragmentation, thus assembling multiple memory fragments into one large memory block.
Note that some processes cannot be moved, such as reading and writing IO.
Partner algorithm
The partner algorithm is an implementation of the Linux underlying memory allocation reclamation algorithm. This article only describes the basic principles of the partner algorithm. The basic idea of ​​the partner algorithm: change the memory size to two.
If the memory block size m requested by a program satisfies the condition 2^n-1 < m < 2^n, then the memory block at this time is allocated to it.

As shown above, we now need 200K space, 1M is equal to 1024K, if m is less than half of 1M, then continue to separate m, when separated to 256, just meet the needs of 200K, so allocate.
When returning, use the idea of ​​memory recovery algorithm to see the neighbors. Merged if not occupied (and why is it a partner algorithm).

For KOBELCO Cylinder Seal Kit


Advantages of Shensteel hydraulic cylinder seals
1. Strong wear resistance: The sealing parts of the Shensteel hydraulic cylinder are made of high-quality materials, which have excellent wear resistance and can withstand high-speed friction and wear.
2. Good sealing performance: Shensteel hydraulic cylinder seals adopt advanced sealing technology, which can effectively prevent liquid leakage and ensure the normal operation of the system.
3. Strong high-temperature resistance: The sealing components of the Shensteel hydraulic cylinder can withstand use in high-temperature environments, are not prone to deformation and aging, and maintain long-term stability.
4. Good corrosion resistance: The sealing parts of the Shensteel hydraulic cylinder are made of corrosion-resistant materials, which can be used in harsh environments and are not easily corroded or damaged.
5. Long service life: Shensteel hydraulic cylinder seals have advantages such as high strength, high wear resistance, high pressure resistance, and high corrosion resistance, which can ensure long-term stable use and extend the service life of the equipment.



For Kobelco Cylinder Seal Kit,Kobelco Rotary Motor Seal Kit,For Kobelco Boom Cylinder Seal Kit,Special Elevator Repair Kit

Safe Seal Technology Co., Ltd. , https://www.jolseals.com

Posted on