關于細分到字段的權限系統
為什么需要細分? (Why Segmentation is required?)
In the Operating System, an important drawback of memory management is the separation of the user's view of memory and the actual physical memory. Paging is the scheme which provides the separation of these two memories.
在操作系統中,內存管理的一個重要缺點是將用戶的內存視圖與實際的物理內存分開。 分頁是提供這兩個內存分離的方案。
The user's view is mapped onto the physical storage. This mapping permits differentiation between logical memory and physical memory.
用戶的視圖已映射到物理存儲上。 此映射允許區分邏輯內存和物理內存。
Operating System may divide the same function into different pages and those pages may or may not be loaded at the same time into the memory and it doesn't care about the User's view of the process. This technique decreases the efficiency of the system.
操作系統可能會將同一功能劃分為不同的頁面,并且這些頁面可能會或可能不會同時加載到內存中,并且它并不關心用戶對進程的看法。 此技術會降低系統的效率。
Segmentation is better than this because it divides the process into the segments.
分段比這更好,因為分段將流程分為多個部分。
什么是細分? (What is Segmentation?)
Segmentation is a memory management technique which supports user's view of memory. This technique of division of a computer's primary memory into sections called segments.
分段是一種內存管理技術,可支持用戶的內存視圖。 將計算機的主內存劃分為稱為段的部分的技術。
細分類型 (Types of Segmentation)
Virtual memory segmentation
虛擬內存分段
Each processor job is divided into several segments, It is not essential all of which are resident at any one point in time.
每個處理器作業都分為幾個部分,所有部分都駐留在任何一個時間點上并不是必須的。
Simple segmentation
簡單分割
Each process is divided into many segments, and all segments are loaded into the memory at run time, but not necessarily contiguously.
每個進程都分為許多段,并且所有段都在運行時加載到內存中,但不一定是連續的。
細分的基本方法 (Basic method for Segmentation)
In a computer system using segmentation, a logical address space can be viewed as multiple segments. The size of the segment may grow or shrink that is it is of variable length.
在使用分段的計算機系統中,邏輯地址空間可以視為多個分段。 段的大小可能會變長或變長。
During execution, each segment has a name and a length. The address specifies both the segment name and the displacement within the segment. The user, therefore, specifies each address by two quantities; segment name and an offset.
在執行期間,每個段都有一個名稱和一個長度。 地址同時指定了段名稱和段內的位移。 因此,用戶用兩個數量指定每個地址。 段名稱和偏移量。
Normally it is implemented as segments are numbered and are referred to by a segment number, in place of a segment name. Thus a logical address consists of two tuples:
通常,它是通過對段進行編號并用段號代替段名稱來實現的。 因此,邏輯地址由兩個元組組成:
< segment – number, offset >
<段–數字,偏移量>
Segment number(s) – It is the total number of bits required to represent the segment.
段號 –是表示段所需的總位數。
Segment Offset(d) – It specifies the number of bits required to represent the size of the segment.
段偏移量(d) –它指定表示段大小所需的位數。
細分的硬件支持 (Hardware support for segmentation)
In the program, the user refers to objects by a two-dimensional address, the actual physical memory is still, of course, a one- dimensional sequence of bytes. Thus we have to define an implementation to map two-dimensional user-defined addresses into one-dimensional physical addresses.
在程序中,用戶通過二維地址引用對象,當然,實際的物理內存仍然是一維字節序列。 因此,我們必須定義一種將二維用戶定義地址映射為一維物理地址的實現。
This mapping is affected by a segment table. In the segment table, each entry has a segment base and a segment limit.
此映射受段表的影響。 在細分表中,每個條目都有一個細分基準和一個細分限制。
Segment Base – It contains the starting physical address where the segment kept in memory.
段基礎 –它包含段保留在內存中的起始物理地址。
Segment Limit – It specifies the length of the segment.
網段限制 –指定網段的長度。
The use of the segment table illustrated in this figure:
該段表的用法如圖所示:
Segmentation Hardware
細分硬件
The logical address consists of two parts: a segment number (s) and an offset (d) into that segment.
邏輯地址由兩部分組成:一個段號和到該段的偏移量d。
The segment number used as an index into the segment table.
用作段表索引的段號。
The offset d of the logical address must be between 0 and the segment limit.
邏輯地址的偏移d必須在0和段限制之間。
If offset is beyond the end of the segment, we trap the Operating System.
如果偏移量超出了該段的末尾,我們將捕獲操作系統。
If offset is in the limit, then it is combined with the segment base to produce the address in physical memory, hence the segment table is an array of base limit and register pairs.
如果偏移量在限制范圍內,則將其與段基地址組合以在物理內存中產生地址,因此段表是基極限制和寄存器對的數組。
細分的優勢 (Advantages of Segmentation )
There is no internal fragmentation.
沒有內部碎片。
Segment Table is used to record the segments and it consumes less space in comparison to the Page table in paging.
段表用于記錄段,與分頁中的頁表相比,它消耗的空間更少。
細分的缺點 (Disadvantage of Segmentation )
At the time of swapping, processes are loaded and removed from the main memory, then the free memory space is broken into small pieces, cause of this occurs External fragmentation.
交換時,將進程加載到主內存中并從主內存中刪除,然后將可用內存空間分解成小塊,這是導致外部碎片的原因。
翻譯自: https://www.includehelp.com/operating-systems/segmentation.aspx
關于細分到字段的權限系統