Segmentation in Operating System | Segmentation and Paging

Mahesh Sharma
1 min readAug 8, 2021

--

Segments are used to divide a process. Segments are the chunks of a program that aren’t necessarily all equal in size. Segmentation provides a user with a view of the process that paging doesn’t. There are several types of segmentation.

  1. Virtual memory segmentation -
    Each process is broken down into several segments. Not all segments are resident at the same time.
  2. Simple segmentation -
    Each process is broken into several segments that are all loaded into memory at run-time, but not necessarily in a sequential fashion.

Segmentation does not have a simple relationship between physical and logical addresses. Segment Table is a table that stores information about all segments.

Segment table — This converts two-dimensional Logical addresses into one-dimensional Physical addresses. Each table entry must have:

  • Base address: It contains a starting physical address at which the segments are stored in memory.
  • Limit This specifies the length and width of the segment.

Translation of two-dimensional Logical Address into one dimensional Physical Address

The address generated by the CPU can be divided into:

  • Segment number (s). The number of bits needed to represent the segment.
  • Segment offset d: The number of bits needed to represent the segment’s size.

Segmentation Advantages -

  • There is no internal fragmentation.
  • Segment table takes up less space than Page table in paginating.

Segmentation Disadvantage -

  • As the processes are loaded into and removed from memory, the available memory space is fragmented, leading to External Fragmentation.

--

--

Mahesh Sharma