|
Linux: This Book Includes 4 Manuscripts. The Underground Bible to the unix operating System with Tools On Security and Kali Hacking to Understand Computer Programming, Data Science and Command LineBog'liq Linux This Book Includes 4 Manuscripts The Underground BibleMemory Segmentation
Features Of Memory Segmentation
Memory segmentation allows you to depict a logical address space as a set
of independent variable-length blocks called segments. Each segment
usually contains data for one purpose, for example, one may have a stack,
the other, a program code, etc.
Each segment has a name and length (for ease of implementation, use
names alongside names). The logical address consists of a segment number
and an offset within the segment; the application program works with such
segments. Compilers often create separate segments for different
application data (code segment, the data segment, stack segment). When a
program is loaded into memory, it creates a table of process segment
descriptors, each element of which corresponds to one segment and consists
of a base address, boundary value, and access rights.
When forming an address, its segment portion points to the corresponding
element of the process segment descriptor table. If the offset is greater than
the limit setpoint (or if the process access rights do not match the segment
set rights), then the hardware generates an error. When all is well, the sum
of the base and offset in the case of pure segmentation will result in a
physical address in the main memory. If a segment is uploaded to a disk,
trying to access it causes it to be loaded from the disk into the main
memory. As a result, each segment corresponds to a contiguous block of
memory of the same length, located in an arbitrary location of physical
memory or on a disk. Here are the benefits of memory segmentation.
❖
There is an opportunity to organize several independent segments
of memory for the process and use them to store data of different
nature. However, the access rights to each such segment can be set
differently
❖
Individual segments can be shared by different processes, and their
segment descriptor tables must contain the same elements that
describe that segment
❖
Physical memory corresponding to the process address space
should not necessarily be continuous now. In fact, segmentation
allows individual portions of the address space to be mapped, not to
the main memory, but to the disk and reloaded as needed, ensuring
that processes of any size are executed
This approach is not without its disadvantages.
❖
The need to introduce an additional layer of memory conversion
causes a decrease in performance (this drawback is inherent in any
full implementation of virtual memory). Appropriate hardware
support is required for effective segmentation implementation
❖
Managing variable length memory blocks with the need to store
them on a disk can be quite complicated
❖
The requirement that each segment corresponds to a contiguous
block of the physical memory of the appropriate size causes external
memory fragmentation. Internal fragmentation does not occur in this
case because the segments have a variable length and you can always
select a segment of the length required to execute the program
Today, segmentation is used rather limited, primarily because of the
fragmentation and complexity of implementing efficient memory and disk-
sharing. Wider use of memory allocation got into blocks of fixed length -
page memory organization that will be discussed .
|
|
Bosh sahifa
Aloqalar
Bosh sahifa
Linux: This Book Includes 4 Manuscripts. The Underground Bible to the unix operating System with Tools On Security and Kali Hacking to Understand Computer Programming, Data Science and Command Line
|