80 likes | 190 Views
Segmentation is a memory management scheme that divides programs into variable-sized segments, enhancing a user's view of memory. Each logical address consists of a segment number and an offset, allowing the efficient organization of different components such as main programs, procedures, and variables. The segment table plays a crucial role, mapping logical addresses to physical addresses by using base and limit values for access control. This system aids in sharing segments effectively and can be implemented automatically by compilers or assemblers.
E N D
Segmentation systems • In segmentation, programs are divided into variable size segments. • Every logical address is formed of a segment number and an offset within that segment. • Programs are segmented automatically by the compiler or assembler.
Segmentation systems • 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
Segmentation Architecture • Logical address consists of a two tuple: <segment-number, offset>, • Segment table – maps two-dimensional physical addresses; each table entry has: • base – contains the starting physical address where the segments reside in memory. • limit – specifies the length of the segment. • For logical to physical address mapping, a segment table (ST) is used. When a logical address <segment #,d> is generated by the processor: • Check if ( 0 ≤ d < limit ) in ST. • If o.k., then the physical address is calculated as Base + d, and the physical memory is accessed at memory word ( Base + d ).
Example of Segmentation • For example, assume the logical address generated is <1,123> • Check ST entry for segment #1. The limit for segment #1 is 400. Since 123<400,we carry on. • The physical address is calculated as: 9300 + 123 = 9423, and the memory word 9423 is accessed.