Lyna has tutored undergraduate Information Management Systems and Database Development. She has a Bachelor's degree in Electrical Engineering and a Masters degree in Information Technology.
What Is Memory Segmentation?
Memory is one of the most important resources on a computing system, and its management is primary in every environment. In a bid to use memory efficiently and effectively, a number of techniques have been developed to properly manage it. One of these memory management techniques is known as memory segmentation (MS).
Memory segmentation is a system of segmenting processes that loads information into different non-contiguous addressed spaces in memory. They are referenced using memory addresses. The processes are first segmented (or split) most commonly into three segments: one to house the data, another to house the code, and a third to house the stack.
Programmers may use different variables to achieve this in their program development. The data segment represents all the variables which will be used in running the program, the code segment is the actual execution of the process, while the stack segment monitors the progress and status of the different elements of the program. Now, depending on how complex a program is or its level of sophistication, the program may be comprised of many more segments.
Once the process of segmentation occurs, the entire process can be loaded into different areas in memory instead of one contiguous space. Loading smaller segments of the process into memory allows the physical memory to be used more efficiently. Loading is done by a placement algorithm with processes provided the exact memory space they require as in dynamic partitioning. This technique allows for better memory management, reducing the occurrences of fragmentation.
Programmers armed with this technique segment their programs according to the corresponding program logic. This makes segmentation more realistic to the programmer. How does this all work with memory?
Segmentation & Process Loading
We know that memory is divided into different sections. The operating system, as the diagram indicates, occupies a dedicated section in memory:
A program's processes are divided into segments and are then loaded into memory using a special placement algorithm similar to dynamic partitioning. Recall that dynamic partitioning is a system of loading the process into memory with memory allocations matching the exact size of the processes, eliminating internal fragmentation.
Now the processes of the program are loaded into memory using a placement algorithm that determines which process segment is loaded into which memory location. As such, the different processes that comprise the program can be loaded into different parts of memory. They are referenced using memory addresses in their non-contiguous spaces. Segmentation does not incur internal memory fragmentation but does incur external fragmentation.
Purposes & Benefits
Let's talk a little more about the benefits of memory segmentation.
The capability for both processes and memory to be segmented allows for optimum utilization of memory; multiple running processes can share the memory space. The operating system is isolated in its own partition. Though the different segments that comprise a process occupy non-contiguous areas in memory, this separation does not in any way affect the running of the processes. Processes run unaware that the memory is being shared.
2. Segment Reallocation
The efficiency of memory use entails the removal of completed processes and the reallocation of memory spaces to the awaiting processes. Because program processes are loaded into memory in segments, the programs are in no way disrupted during the reallocation process. In addition, huge blocks of memory are not occupied at any particular time, which means segments of program are more easily reallocated than a program occupying a large single contiguous space of memory.
Where protection within memory is concerned, segmentation provides isolation. The operating system is separate and kept at the highest point in memory. Other application programs have segments in non-contiguous spaces throughout memory. These segments are protected by access rights embedded in the segment table entries.
The MS-DOS and early versions of Windows systems used the flat schema mode of addressing to address 16-bit systems. With the advancement of processor technology and the dawn of the new Intel 8086, processors were designed to address 1MB of memory, which were hindered if the flat addressing system was maintained. Segmentation, therefore, allowed the extension of flat addressing to accommodate the 1MB systems.
Memory segmentation describes the system of segmenting processes and loading the information into non-contiguous spaces in memory. This allows for better efficiency in memory management. Though the system incurs external fragmentation it allows for smaller chunks of segmented processes to be loaded. This allows multiple programs to share memory, provides segment-level protection handled by the operating system, and extends the flat addressing system to accommodate 1MB systems used by modern processors.
To unlock this lesson you must be a Study.com Member.
Create your account
Register to view this lesson
Unlock Your Education
See for yourself why 30 million people use Study.com
Become a Study.com member and start learning now.Become a Member
Already a member? Log InBack