What are the advantages of having segmentation? How does 8086 µP support segmentation?
The concept of memory segmentation has been introduced in the 8086 processor. Segmentation
of memory is possible through the different segment registers such as Code Segment (CS), Data
Segment (DS) Extra Segment (ES) and Stack Segment (SS). The segmentation can be used by
programmer in relocating the program very easily. In a multiprogramming environment, access
rights can easily be implemented with segments. It is also possible to share segments by different
process. 8086 processor has separate data and code segments. So that, logical address of program
can be loaded into specified segment register and run the program from anywhere in memory.
Sometimes, one program can work on several different sets of data. This is possible by reloading
logical address in DS register and the same program can be run with the new data.
The advantages of segment memory are given below:
(i) Allow the memory capacity to be 1MB even though the addresses associated with the
individual instructions are 16 bits wide.
(ii) Allow the use of separate memory areas for the program code and data and stack portion of
the program
(iii) Permit a program and/or its data to be placed into different areas of memory whenever the
program is executed.
(iv) Multitasking becomes easy
(v) The advantage of having separate code and data segments is that one program can work on
different sets of data. This is possible by reloading data segment register DS to the point to the
new data.
(vi) Advantage of segment memory is that the reference logical addressed can be loaded into
instruction pointer IP and run the program any where of segment memory as the logical
address varies from 0000H to FFFFH.
(vii) Programs are re-locatable so that programs can be run at any location in memory.
In 8086, the code segment register is used for addressing a memory location in the code
segment of the memory in which the program is stored for execution. Data segment register
points to the data segment of the memory, where data is stored. The extra segment is a segmen
which can be used as another data segment of the memory. Therefore, extra segment contains
data. The stack segment register is used for addressing stack segment of memory in which
stack data is stored. The CPU uses the stack for temporarily store data, i.e. the content of all
general purpose registers which will be used later. In memory segmentation, the complete
1MB memory can be divided into 16 parts which are called segments. Each segment thus
contains 64 KB of memory. Figure 1