Explain the concept of segment memory.
Memory
segmentation is the division of a = computer's primary memory into segments or
sections. In a computer system using segmentation, a reference to a memory
location includes a value that identifies a segment and an offset (memory
location) within that segment. Segments or sections are also used in object files
of compiled programs when they are linked together into a program image and
when the image is loaded into memory.
The need of memory segmentation is explained
below:
(i) 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.
(ii) All these are 16 bit registers.
(iii) 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.
(iv) 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.
(v) 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
8036 is winking at that instant of time.
(vi) A segment is a logical unit of memory that may be up to 64 kilo bytes
long.
(vii) Each segment is made up of memory contiguous memory locations. It is
independent, separately addressable unit.
(viii) Starting addresses will always be changing. They are not
fixed.
(ix) Figure shows one of the possible ways to position the four 64 KB
segments within the 1 MB memory space of 8086.
One
way of positioning four 64k byte segments within the 1M byte memory space an
8086
(i) 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.
(ii) In the users 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.
(iii) 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.
(iv) 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.
(v) Segmentation builds reloadable 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.
No comments
Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....