Computer Operating System Fundamentals (9)-Segment and Page Storage Management of Storage Management

introduction

This article is the ninth article, the segment page storage management of storage management . The previous article introduced the memory allocation and recovery of storage management, and learned about storage management from a physical point of view. This article learned about process storage management from the perspective of process. That is how the operating system manages the process space

Page storage management

Before that, let’s understand the concept of pages

In principle the composition has a computer word and word block concept, the word block is defined relative to the physical device (such as memory). The page is the definition of the relative logical space (that is , the definition of the relative process space). Both blocks and pages refer to a piece of memory of the same size

  • Page-based storage management divides the process logical space into several size pages.
  • Correspondingly, the physical memory space will be divided into physical blocks the same as the page size
  • In units of pages, the process space is loaded into scattered physical blocks in physical memory

This is also storage management. When understanding page storage management, it is usually understood together with memory fragmentation.

Below is a free linked list. Suppose there is a page that is larger than node 1 and smaller than node 2 and node 3. Therefore, when allocating pages, the page needs to be allocated to node 2 and node 3, so some memory will not be used it will cause memory fragmentation exists

So if you use page storage management , you need:

  • Moderate page size, too large to allocate, too small memory fragmentation
  • The page size is usually 512B~8K

Through page storage management, each page of the logical space of the process can be placed in a physical block of memory, but how do we know which block of a certain page of the process is allocated? So need to understand page table

The page table records the mapping of process logical space and physical space

On the left is the logical space of the process. The logical space of the process is divided into 5 pages. These 5 pages are scattered in scattered physical blocks of the main memory. Therefore, the page table records the mapping relationship:

If you use page storage management directly, you will also encounter some problems:


If there is a continuous logic distributed in multiple pages, it will greatly reduce the execution efficiency

Duan's Storage Management

  • Divide the process logic space into several segments ( non-equal division )
  • The length of the segment is determined by the length of the continuous logic
  • Main function main, subroutine segment X, sub function Y, etc. (At this time, the logical space will be allocated according to the logical length of each function)

Segment storage management also needs a table to store the mapping from logical space to physical space, this is the segment table

The length of each segment is not fixed, so the segment table is one more segment length than the page table

Compare two storage management methods:

Common points:

Both segment storage and page storage discretely manage the logical space of the process

difference:

  • Page is the physical unit, segment is the logical unit
  • Paging is for rational use of space, segmentation is to meet user requirements
  • The size of the page is fixed by hardware, and the length of the segment can be dynamically changed
  • Page table information is one-dimensional, segment table information is two-dimensional

Segment page storage management

A storage management method formed by using the advantages of the first two storage management

  • Paging can effectively improve memory utilization
  • Segmentation can better meet user needs

Segment page storage management

  • First divide the logical space into segments according to segment management
  • Then divide the space in the paragraph into several pages according to page management

From left to right are the memory allocation of segment page, page type, and segment

It is the core competitiveness of a technical person to find the constant in the rapidly changing technology. Unity of knowledge and action, combining theory with practice

Guess you like

Origin blog.csdn.net/self_realian/article/details/107081869