|
Segmentation
Memory-management scheme that supports user view of memory. A program is a collection of segments. A segment is a logical unit such as: main program procedure function method object local variables global variables common block stack symbol table arrays
User’s View of a Program
Segmentation Architecture
Logical address consists of a two tuple: <segment-number, offset>, Segment table – maps two-dimensional physical addresses; each table entry has: 1. base – contains the starting physical address where the segments reside in memory. 2. limit – specifies the length of the segment. Segment-table base register (STBR) points to the segment table’s location in memory. Segment-table length register (STLR) indicates number of segments used by a program; segment number s is legal if s < STLR. Relocation. 1. dynamic 2. by segment table 3. Sharing. 4. shared segments 5. same segment number 6. Allocation. 7. first fit/best fit 8. external fragmentation Protection. With each entry in segment table associate: 1. validation bit = 0 _ illegal segment 2. read/write/execute privileges Protection bits associated with segments; code sharing occurs at segment level. Since segments vary in length, memory allocation is a dynamic storage-allocation problem. A segmentation example is shown in the following diagram
Segmentation Hardware
Example of Segmentation
Sharing of Segments
|