Open In App

Segmentation in Operating System

Last Updated : 07 May, 2024
Like Article

A process is divided into Segments. The chunks that a program is divided into which are not necessarily all of the exact sizes are called segments. Segmentation gives the user’s view of the process which paging does not provide. Here the user’s view is mapped to physical memory.

Types of Segmentation in Operating System

  • Virtual Memory Segmentation: Each process is divided into a number of segments, but the segmentation is not done all at once. This segmentation may or may not take place at the run time of the program.
  • Simple Segmentation: Each process is divided into a number of segments, all of which are loaded into memory at run time, though not necessarily contiguously.

There is no simple relationship between logical addresses and physical addresses in segmentation. A table stores the information about all such segments and is called Segment Table. 

What is Segment Table?

It maps a two-dimensional Logical address into a one-dimensional Physical address. It’s each table entry has:

  • Base Address: It contains the starting physical address where the segments reside in memory.
  • Segment Limit:  Also known as segment offset. It specifies the length of the segment.


Translation of Two-dimensional Logical Address to Dimensional Physical Address. 



 The address generated by the CPU is divided into:

  • Segment number (s): Number of bits required to represent the segment.
  • Segment offset (d): Number of bits required to represent the position of data within a segment.

Advantages of Segmentation in Operating System

  • No Internal fragmentation.
  • Segment Table consumes less space in comparison to Page table in paging.
  • As a complete module is loaded all at once, segmentation improves CPU utilization.
  • The user’s perception of physical memory is quite similar to segmentation. Users can divide user programs into modules via segmentation. These modules are nothing more than separate processes’ codes.
  • The user specifies the segment size, whereas, in paging, the hardware determines the page size.
  • Segmentation is a method that can be used to segregate data from security operations.
  • Flexibility: Segmentation provides a higher degree of flexibility than paging. Segments can be of variable size, and processes can be designed to have multiple segments, allowing for more fine-grained memory allocation.
  • Sharing: Segmentation allows for sharing of memory segments between processes. This can be useful for inter-process communication or for sharing code libraries.
  • Protection: Segmentation provides a level of protection between segments, preventing one process from accessing or modifying another process’s memory segment. This can help increase the security and stability of the system.

Disadvantages of Segmentation in Operating System

  • As processes are loaded and removed from the memory, the free memory space is broken into little pieces, causing External fragmentation.
  • Overhead is associated with keeping a segment table for each activity.
  • Due to the need for two memory accesses, one for the segment table and the other for main memory, access time to retrieve the instruction increases.
  • Fragmentation: As mentioned, segmentation can lead to external fragmentation as memory becomes divided into smaller segments. This can lead to wasted memory and decreased performance.
  • Overhead: Using a segment table can increase overhead and reduce performance. Each segment table entry requires additional memory, and accessing the table to retrieve memory locations can increase the time needed for memory operations.
  • Complexity: Segmentation can be more complex to implement and manage than paging. In particular, managing multiple segments per process can be challenging, and the potential for segmentation faults can increase as a result.

FAQs on Segmentation

1. What is Segmentation?


Segmentation in Operating systems can be determined as a division of primary memory into small-sized blocks.

2. Why is Segmentation used in OS?


Segmentation is a memory management technique that is used to improve the performance of an Operating System.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads