关于细分到字段的权限系统
为什么需要细分? (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
关于细分到字段的权限系统