- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Segmentation in Operating System
In the Operating System, Segmentation is mainly useful to maintain the modular structure of a program. The purpose of using segmentation is to achieve the user's view of memory allocation similarly when paging does not bother where programs start and end and it simply divides the program into pages. The non-adjacent memory allocation technique can be divided into two types namely paging and segmentation. In segmentation, the program is not divided randomly or with a variable size but with a fixed page.
Segmentation in OS
The segmentation technology is used in operating systems and the process is divided into many pieces called segments and these segments are of variable size. In this, segmentation uses a variable partitioning method: one segment is equal to one complete memory block. The access and details of each segment, they are stored in a segment table consisting of two fields. The base field gives the starting address from which other addresses get access and the limit field returns the length of the section.
A segment can be defined as a logical grouping of instructions such as an array. Subroutine, function, local variable, stacks, blocks, and symbol table. Segmentation is the technique for managing these segments.
The Segmentation fault can be noticed in two different ways when the method of handling is wrong and when any unauthorized program tries to use the segments in the Operating system.
Process for converting Logical address into Physical address
The logical address will be extensively used in the memory management process and it is composed of segment number which ranges from 0 to 99 and the offset.
Based on the length there may be two cases
Case-1 − When the offset value is greater than or equal to the limit
Case-2 − When the offset value is less than the limit.
Why Segmentation is used?
The primary purpose of using segmentation is to increase the security and protection of the segments. It manages each divided segment and allows only one process to access the segment preventing too many processes
The Segmentation technique is used for memory allocation in Operating systems which partitions the program into different parts. The divided segments are identified using the sequence number and it is maintained by the segment table for easy access. The segment table is used to map the segment numbers to the actual memory locations of its storage.
These segments occupy the memory only when the segments are required and it loads that specific segment of different sizes. Internal fragmentation is reduced by fixing the segments to fit into the size of the data. Since the memory is utilized only when needed, the operating system can make use of available memory
Advantages of Segmentation in Operating System
Using segmentation, system efficiency can be improved by allowing various sub-parts to run on separate processors.
The processes in the Operating system are performed concurrently by the powerful way of responding to the system request
The Central Processing Unit is utilized maximum for better usage
The Problem caused by internal fragmentation is resolved with the help of Segmentation.
The tracking of segments is possible using the segment table, but this takes some memory for storing these segments.
Compared to paging, segmentation involves less processing overhead. Moving segments on a disc is easier than moving entire address spaces because of segmentation. Segment tables use less memor
Disadvantages of Segmentation in Operating System
If the overall storage capacity is used and some sort of memory is left behind without usage then the segmentation may experience external fragmentation. As a result, allocating adjacent memory to partitions of different sizes may be challenging.
The Segmentation of memory allocation can be costly.
When the segments are of different sizes they cannot undergo the process of swapping.
Segmentation provides a flexible and efficient way for operating systems to manage memory, reducing internal fragmentation and improving memory utilization while also providing a level of protection between segments. Thus Segmentation improves the way the memory is managed in Operating System to provide more security and stability.
Kickstart Your Career
Get certified by completing the courseGet Started