Segmented Memory
Allocation : A well structured program
consists of modules and also the relations between the modules or
dessigned data a module is also known as a segment.A segment can be
defined as logical group of information
such as a subroutine or data area A segment may be a program of subprogram or a
data base. A program and its data can be
viewed as linked segment each segment has a name and off set. The physical addresses assigned to the
segments are maintained in a segment table the memory management
technique that allocates main memory to segments is called
segmentation.
Virtual memory can also be accomplished
segmentation. Initially all the
segments are stored secondary storage
device. At the time of execution,
there is a call statement that requires one segment when the required segment
is not in the memory then the operating system searches the secondary
storage device and bought into the memory.
In this way the operation system links the calling segment
to its coiller. The operation system
must find a room for new segments by using compacting technique or by
removing one of the segments in the memory.
Advantages
:
1. It
eliminates fragmantation.
2. It
avoides virtual memory.
3. It
helps in dynamic linking.
Dis-Advantages
:
1.There
is a difficulty in managing segments of different
sizes on secondary storage device.
2.The maximum size of the main
memory.
3.Memory compacting is required.
4.Increases the hardware cost.
Difference Between Paging And
Segmentation :
1)
A segment is a logical unit of information, visible
the user's program and is of orbitary size. A page is a
physical unit of information, invisible the user's program and is
of fixed size.
2) In
paging a new page is loaded in the memory by replacing one of the pages
already in
the memory where as in segmentation process the
operating system makes a remove for incoming segment by
compacting memory or by replaces a segment from the memory.
Segmented Paged
Memory Allocation : In this memory allocation-method paging and
segmentation can be combined to gain the advantage of
both. This is done by dividing
each segment into pages. By
physically manupulating these pages the problems of compaction,
secondary storage handling and limitation on segments size are
removed. In this memory allocation
scheme a word in main memory a logical address with three
components.
1.Segment address
2.Page address
3.Line address
This
scheme uses a segment table and a set of page tables. One page table is required
for each segment the segment table register indicates
the location and length of the current segment table. The segment table consists the
each segment address and a pointer to the base of the
corresponding page table the page table consists of the page
numbers of a segment and page frame numbers used for loading the pages in
the memory.
Initially
all the system segments are stored in secondary storage device when
a page is required for execution, if it is not in
the memory then the operation system examines the segment table
and page table and then the page is transferred from
the secondary storage
device to the main
memory. If the memory is not available
the required page is placed in the memory by replacing one of the previous
pages.