Paging, segmentation and segment page storage management

1. Paging management

  Paging storage management is to divide the logical address space of a process into several equal-sized slices, called pages or pages, and number each page, starting from 0, such as page 0, page 1, and so on. Correspondingly, the memory space is also divided into several storage blocks of the same size as the page, called (physical) blocks or page frames (frame), and they are also numbered, such as 0# block, 1# block and so on. When allocating memory for a process, several pages in the process are loaded into multiple non-contiguous physical blocks in block units. Because the last page of the process is often not filled with one piece, an unusable fragment is formed, which is called "in-page fragmentation".
Pros and Cons: No external fragmentation, high memory utilization. However, the content of each page is not related, which is not conducive to programming and sharing.

2. Segmentation management

  Divide the program into segments according to content or procedure (function) relationship, each segment has its own name. A segment included in a user job or process corresponds to a two-dimensional linear virtual space, that is, a two-dimensional virtual memory. The segmented hypervisor allocates memory in units of segments, and then converts segmented virtual addresses into actual memory physical addresses through an address mapping mechanism.
  The program is divided into multiple modules by segmentation, such as code segment, data segment, and shared segment. The size of each segment of memory matches the program segment, and no internal fragmentation occurs.
Advantages and disadvantages: Different protections can be taken for different types of segments. Sharing can be done on a segment-by-segment basis, including code sharing through dynamic linking. No internal fragmentation occurs, but external fragmentation occurs, and memory utilization is lower than paging.

3. Segment page management

  Programs or data with independent logical functions contained in a process are still divided into segments and have their own segment numbers s. This reflects that the phase has inherited the characteristics of segment management. Secondly, for the program or data in the segment s, it is divided into different pages according to a certain size. As with the page system, the last part that is less than a page still occupies a page. This reflects the page-style characteristics in segment-page-style management. Therefore, the virtual address in the virtual address space of the process during segment page management consists of three parts: the segment number s, the page number P and the relative address d in the page. The smallest unit of virtual space is a page rather than a segment, so the memory available area is divided into pages of equal size, and the programs and data owned by each segment can be stored separately in memory. The size of the segment is also no longer limited by the memory availability zone.
  In order to achieve segment page management, the system must establish a segment table for each job or process to manage memory allocation and release, segment missing processing, and address conversion of storage protection phases. In addition, since a segment is divided into several pages, each segment must create a page table to convert virtual pages in the segment into actual pages in memory. Obviously, as in the page-based management, the page table also has corresponding entries for implementing functions such as page fault interrupt processing and page protection. In addition, because in the segment page management, the page table no longer belongs to the process but to a certain segment. Therefore, there should be a special item in the segment table indicating the page table start address and page table length of the page table corresponding to the segment.
Advantages and disadvantages: There are segments with independent logical functions, and pages of the same size are used as memory allocation units so that no external fragmentation occurs. But there will still be internal debris.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325618455&siteId=291194637