Next: Paging
Up: No Title
Previous: No Title
- A segment is a region of logically contiguous memory
- Have a table of branch and bounds
![figure45](img3.gif)
Figure 6: Segment based mapping
- Program issues a (binary) virtual address 10011 which
translates to location 19. However, the virtual address is broken
into 100 (which is the segment number) and an offset 11. The segment
number is added to a base register (which contains the base address of the
segment table), and is used to reference a location within the segment table.
- The real/physical address is obtained by adding the segment table
entry with the offset. The segment table entry is the primary storage address.
Consider the following with 2 bit segment ID, and 12 bit segment offset.
virtual segment no. physical segment segment size
start
code 0x4000 0x700
data 0 0x500
stack 0x2000 0x1000
![figure58](img4.gif)
Figure: Segment based mapping
- Possible to have a protection mechanism for segments, to control process access
- Four main categories of access : Read, Write, Execute and Append -
can combine modes to obtain more complex access strategies.
- A more detailed segment table entry contains : segment present,
secondary memory address, segment length, access control bits,
address of segment if in primary memory
- missing segment fault : segment NOT in main (primary) memory (load segment from
2ndary memory)
- segment overflow exception: displacement is greater than segment length
- segment protection exception: required operation not permitted on segment
![figure75](img5.gif)
Figure: Segment based mapping
- Segments can be of arbitrary size - hence a segment used to represent
a dynamic structure can grow as the structure grows. Also, a segment
may shrink in size over its life time (same reasoning as growing)
- Possible to share segments between processes. This is achieved by simply
pointing the segment table addresses of the processes to the same position in main
(primary) memory.
![figure85](img6.gif)
Figure: Segment based mapping
- Segmentation + : Efficient for sparse address spaces
Easy to share segments
Support for dynamic data structures which can grow or shrink over time
- Segmentation - : Complex memory allocation
Still need shuffling to coalesce free space - if no free space for a segment
- Need to simplify - so how do we make memory allocation simple and easy ?
Next: Paging
Up: No Title
Previous: No Title
Omer F Rana
Thu Feb 13 12:31:55 GMT 1997