Segmentation
Segmentation
Address specifies segment name and offset within segment both defined by the user.
The user program is compiled, and the compiler automatically constructs segments
reflecting the input program.
HARDWARE:
Entry : a segment base(starting physical address where the segment resides in memory)
and a segment limit(the length of the segment).
If the offset is legal, it is added to the segment base to produce the address in physical
memory of the desired byte.
2. Each process has a segment table associated with it, which the dispatcher uses to
define the hardware segment table when this process is given the CPU. Segments
are shared when entries in the segment tables of two different processes point to
the same physical location.
Sharing occurs at segment level. Any info defined to be a segment could be shared.
FRAGMENTATION :
cause external fragmentation, when all blocks of free memory are too small to
accommodate a segment
Process waits until more memory (or at least a larger hole) becomes available, or until
compaction creates a larger hole
If the CPU scheduler must wait for one process, because of a memory allocation problem,
it may (or may not) skip through the CPU queue looking for a smaller, lower-priority
process to run.
Solution:
2. every byte could be put in its own segment and relocated separately. This
arrangement eliminates external fragmentation
In this every byte needs base register for its relocation, hence the memory used is
doubled.
1. Paging: the average segment size is small, external fragmentation will also be small.
And since individual segments are smaller than the overall process, they are more
likely to fit in the available memory blocks.