What is segmentation? Give usages, advantages of segmentation.




1 Answer

The need of memory segmentation is explained below:

  • The BIU (Bus Interfacing Unit) contains four special purpose registers called as segment registers. These are Code Segment (CS) register, Stack Segment (SS) register, Extra Segment (ES) register and Data Segment (DS) register.
  • All these are 16 bit registers.
  • The number of address lines in 8086 is 20. So the 8086 BIU will send out a 20 bit address in order to access one of the 1,048,576 or 1MB memory locations.
  • But it is interesting to note that the 8086 does not work the whole 1MB memory at any given time. However it works with only four 64 KB segments within the whole 1 MB memory.
  • The four segment registers actually contain the upper 16 bits of the starting addresses of the four memory segments of 64 KB each with which the 8086 is working at that instant of time .
  • A segment is a logical unit of memory that may be up to 64 kilobytes long.
  • Each segment is made up of memory contiguous memory locations. It is independent, separately addressable unit.
  • Starting addresses will always be changing. They are not fixed.
  • The figure shows one of the possible ways to position the four 64 KB segments within the 1 MB memory space of 8086.


  • There is no restriction on the locations of these segments in the memory. These segments can be separate from each other or they can overlap.
  • In the user's program, there can be many segments but 8086 can deal with only four of them at any given time because it has only four segment registers
  • Whenever the segment orientation is to be changed, the base addresses have to be changed and load the upper 16 bits into the corresponding segment registers
  • Segment registers are very useful for large programming tasks that require isolation of program code from the data code or isolation of module data from the stack information etc
  • Segmentation builds relocatable and re-entrant programs easily. In many cases, the task of relocating a program simply requires moving the program code and then adjusting the code segment register to point to the base of the new code area.

Advantages of memory segmentation:

  • Segmentation provides a powerful memory management mechanism.

  • It allows programmers to partition their programs into modules that operate independently of one another.

  • Segments allow two processes to easily share data.

  • It allows to extend the addressability of a processor i.e. segmentation allows the use of 16-bit registers to give an addressing capability of 1 MB. Without segmentation, it would require 20-bit registers.

  • Segmentation makes it possible to separate the memory areas for stack, code, and data.

  • It is possible to increase the memory size of code data or stack segments beyond 64 KB by allotting more than one segment for each area.

Please log in to add an answer.