The purpose of storage management is to facilitate users and improve memory utilization; the object of storage management is main memory, also called memory. Its main functions include allocating and recycling main memory space, improving main memory utilization, and expanding Main memory, effective protection of main memory information.
The purpose of storage management is to facilitate users and improve memory utilization.
The object of memory management is main memory, also called memory. Its main functions include allocating and reclaiming main memory space, improving main memory utilization, expanding main memory, and effectively protecting main memory information.
Storage Management Solution
The main purpose of the storage management solution is to solve the problem of multiple users using main memory. Its storage management solution mainly includes partition storage management and paging storage. Management, segmented storage management, segmented paged storage management, and virtual storage management.
Partition Storage
There are three different ways to manage partition storage: static partition, variable partition, and relocatable partition.
Static Partition
Static partition storage management is to divide the allocable main memory space into several consecutive areas in advance. The size of each area can be the same or different. In order to explain the allocation and usage of each partition, storage management needs to set up a "main memory allocation table". The main memory allocation table indicates the starting address and length of each partition. The occupied flag bit in the table is used to indicate whether the partition is occupied. When the occupied flag bit is "0", it means that the partition has not been occupied. When allocating main memory, always select those partitions with the flag "0". When a partition is assigned to a job, fill in the name of the job occupying the partition in the occupation flag column. Using static partition storage management, the utilization of main memory space is not high. [2]
Variable partitioning
The variable partitioning method is to divide the partitions according to the size of the job. When a job is to be loaded, check whether there is enough space in the main memory based on the amount of main memory required by the job. If there is enough space, divide a partition according to the required amount and allocate it to the job; if not, make the job wait for main memory space. . Since the size of the partition is determined according to the actual needs of the job, and the number of partitions is also random, the waste of main memory space in the fixed partition method can be overcome.
With the loading and evacuation of jobs, the main memory space is divided into many partitions, some partitions are occupied by jobs, and some partitions are free. When a new job requires loading, you must find a large enough free area and load the job into this area. If the free area found is larger than the job requirements, the original free area will be divided into two parts after the job is loaded. , part of it is occupied by jobs; the other part is divided into a smaller free area. When a main row is evacuated, if the area it returns is adjacent to other free areas, it can be combined into a larger free area to facilitate the loading of large jobs.
Variable partition scheduling algorithm
1) First adaptation algorithm. Each time it is allocated, the unallocated table is always searched sequentially until the first free area that meets the length requirement is found. Split the found unallocated area, part of it is allocated to the job, and the other part is still a free area. This allocation algorithm may divide a large space into small areas, resulting in more main memory "fragments".
2) Best adaptation algorithm. Select the smallest partition from the free area that can meet the job requirements. This ensures that a larger area is not divided, making it easier to satisfy large jobs when loading them. When using this allocation algorithm, the free areas can be arranged smoothly in increasing sizes. When searching, always start from the smallest area until an area that meets the requirements is found.
3) Worst adaptation algorithm. Select the largest free area for the job to use, so that the remaining free area will not be too small. This algorithm is beneficial to medium and small jobs. When using this allocation algorithm, the free areas can be smoothly arranged in descending order, and the search always starts from the largest area. In this way, the table must also be rearranged when a partition is reclaimed.
Paging storage
Paging storage management is to divide the logical address space of a process into several equal-sized pieces, called pages or pages, and number each page, starting from 0. Such as page 0, page 1, etc. Correspondingly, the memory space is also divided into several storage blocks of the same size as the page, called (physical) blocks or page frames, and they are also numbered, such as 0# block, 1# block, etc. When allocating memory to a process, several pages in the process are loaded in block units into multiple physical blocks that may not be contiguous. Because the last page of the process often does not fit into one piece, unusable fragmentation is formed, which is called "in-page fragmentation".
Segmented Storage
В методе управления сегментированным хранилищем адресное пространство задания разделено на несколько сегментов, и каждый сегмент определяет набор логической информации. Например, есть сегмент основной программы MAIN, сегмент подпрограммы X, сегмент данных D, сегмент стека S и т. д. Каждый сегмент имеет свое имя. Для простоты вместо имени сегмента обычно можно использовать номер сегмента.Каждый сегмент адресуется, начиная с 0, и использует непрерывное адресное пространство. Длина сегмента определяется длиной соответствующей группы логической информации, поэтому длина каждого сегмента различна. Поскольку адресное пространство всего задания разделено на несколько сегментов, оно является двумерным, то есть его логический адрес состоит из номера сегмента (имени сегмента) и адреса внутри сегмента.
Сегментированное хранилище страниц
Основным принципом системы сегментных страниц является сочетание базового метода управления сегментным хранилищем и базового метода управления страничным хранилищем.То есть сначала разделяется пользовательская программа. на несколько сегментов. Затем разделите каждый сегмент на несколько страниц и присвойте каждому сегменту имя.
Виртуальное хранилище
Когда требуемое пространство для хранения программы превышает фактическое пространство памяти, это затрудняет запуск программы. Технология виртуального хранения использует фактическое пространство памяти и относительно большое внешнее пространство хранения для формирования виртуального пространства хранения, которое намного больше фактического пространства памяти. Программа работает в этом виртуальном пространстве хранения. В основе реализации виртуального хранилища лежит принцип локальности программы, то есть в процессе выполнения программа часто отражает характеристики работы в определенной локальной области. Во времени часто выполняются одни и те же сегменты команд и данные (так называемая временная локальность). В пространстве часто выполняются инструкции и данные в определенном локальном пространстве хранения (так называемая пространственная локальность). Некоторые сегменты программы не могут выполняться одновременно. Или не бегайте вообще. Виртуальное хранилище делит пространство памяти, необходимое программе, на несколько страниц или сегментов. Страницы и сегменты, используемые программой, хранятся в памяти и сохраняются во внешней памяти, когда они временно не используются. Когда страницы и сегменты внешней памяти используются, они передаются в память и наоборот, отправляются во внешнюю память. Страницы или сегменты, загруженные в память, могут быть разбросаны.
The above is the detailed content of What is the purpose of storage management. For more information, please follow other related articles on the PHP Chinese website!