首頁 > 常見問題 > 主體

儲存管理的目的是什麼

藏色散人
發布: 2020-11-30 11:21:01
原創
15848 人瀏覽過

儲存管理的目的是方便使用者和提高記憶體使用率;記憶體管理的物件是主記憶體,也稱為記憶體,它的主要功能包括分配和回收主存空間、提高主存利用率、擴充主存、對主存資訊實現有效保護。

儲存管理的目的是什麼

儲存管理的目的是方便使用者和提高記憶體使用率

記憶體管理的物件是主存,也稱為記憶體。它的主要功能包括分配和回收主存空間、提高主存利用率、擴充主存、對主記憶體資訊實現有效保護。

儲存管理方案

儲存管理方案的主要目的是解決多個使用者使用主記憶體的問題,其儲存管理方案主要包括分區儲存管理、分頁存儲管理、分段儲存管理、段頁式儲存管理以及虛擬儲存管理。 

分區儲存

分區儲存管理又有三種不同的方式:靜態分區、可變分區、可重定位分區 。

靜態分區

靜態分區儲存管理是預先把可分配的主記憶體空間分割成若干個連續區域,每個區域的大小可以相同,也可以不同。為了說明各分區的分配和使用情況,儲存管理需設定一張「主存分配表」。主存分配表指出各分區的起始位址和長度,表中的佔用標誌位元用來指示該分割區是否被佔用了,當佔用的標誌位元為「0」時,表示該分割區尚未被佔用。進行主記憶體指派時總是選擇那些標誌為「0」的分割區,當某一分割區指派給一個作業後,則在佔用標誌欄填上佔用該分割區的作業名。採用靜態分區儲存管理,主記憶體空間的利用不高。 [2] 

可變分區

可變分區方式是依作業的大小來分割分割區。當要裝入一個作業時,根據作業需要的主存量查看主記憶體中是否有足夠的空間,若有,則按需要量分割一個分區分配給該作業;若無,則令該作業等待主存空間。由於分區的大小是依照作業的實際需要量來定的,且分區的個數也是隨機的,所以可以克服固定分區方式中的主存空間的浪費。

隨著作業的裝入、撤離,主記憶體被分成許多個分區,有的分區被作業佔用,而有的分區是空閒的。當一個新的作業要求裝入時,必須找一個足夠大的空閒區,把作業裝入該區,如果找到的空閒區大於作業需要量,則作業裝入後又把原來的空閒區分成兩部分,一部分給了作業;另一部分又分成為一個較小的空閒區。當一作主行結束撤離時,它歸還的區域如果與其它空閒區相鄰,則可合成一個較大的空閒區,以利大作業的裝入。

可變分區調度演算法

1)首次適應演算法。每次分配時,總是依序尋找未分配表,找到第一個能滿足長度要求的空閒區為止。分割這個找到的未分配區,一部分分配給作業,另一部分仍為空閒區。這種分配演算法可能將大的空間分割成小區,造成較多的主記憶體「碎片」。

2)最佳適應演算法。從空閒區中挑選一個能滿足作業要求的最小分區,這樣可保證不去分割一個更大的區域,使裝入大作業時比較容易得到滿足。採用這種分配演算法時可把空閒區依大小以遞增順利排列,查找時總是從最小的一個區開始,直到找到一個滿足要求的區為止。

3)最壞適應演算法。挑選一個最大的空閒區分割給作業使用,這樣可使剩下的空閒區不至於太小,這種演算法對中、小作業是有利的。採用這種分配演算法時可把空閒區依大小以遞減順利排列,查找時總是從最大的一個區開始。依此方法,在收回一個分割區時也必須對表格重新排列。

分頁儲存

分頁儲存管理是將一個行程的邏輯位址空間分成若干個大小相等的片,稱為頁面或頁,並為各頁加以編號,從0開始,如第0頁、第1頁等。對應地,也把記憶體空間分成與頁面相同大小的若干個儲存區塊,稱為(物理)區塊或頁框(frame),也同樣為它們加以編號,如0#區塊、1#區塊等等。在為進程分配記憶體時,以區塊為單位將進程中的若干個頁分別裝入到多個可以不相鄰接的實體區塊中。由於進程的最後一頁經常裝不滿一塊而形成了不可利用的碎片,稱之為「頁內碎片」。

分段儲存

In the segmented storage management method, the address space of the job is divided into several segments, and each segment defines a set of logical information. For example, there are main program segment MAIN, subprogram segment X, data segment D, stack segment S, etc. Each segment has its own name. For the sake of simplicity, a segment number can usually be used instead of the segment name. Each segment is addressed starting from 0 and uses a continuous address space. The length of the segment is determined by the length of the corresponding logical information group, so the length of each segment is different. Since the address space of the entire job is divided into multiple segments, it is two-dimensional. That is, its logical address consists of the segment number (segment name) and the address within the segment.

Segment page storage

The basic principle of the segment page system is a combination of the basic segmented storage management method and the basic paging storage management method. That is, the user program is first divided into several segments. Then divide each segment into several pages and assign a segment name to each segment.

Virtual Storage

When the storage space requirement of the program is greater than the actual memory space, it makes the program difficult to run. Virtual storage technology uses actual memory space and a relatively large external storage space to form a virtual storage space that is much larger than the actual memory space. The program runs in this virtual storage space. The basis for realizing virtual storage is the principle of locality of the program, that is, during the running process, the program often reflects the characteristics of running within a certain local scope. In time, the same instruction segments and data are often run (called temporal locality). In space, instructions and data in a certain local storage space are often run (called spatial locality). Some program segments cannot be run at the same time. Or don't get run at all. Virtual storage divides the storage space required by a program into several pages or segments. The pages and segments used by the program are stored in the memory, and they are stored in external memory when they are not used temporarily. When the pages and segments in the external memory are used, they are transferred to the memory, and vice versa, they are sent to the external memory. Pages or segments loaded into memory can be scattered.

以上是儲存管理的目的是什麼的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!