Unit 5memory Management
Unit 5memory Management
Memory Management
Memory Management
Background
Swapping
Contiguous Allocation
Paging
Segmentation
Compile time
Load time
Execution time
Binding of Instructions and Data to
Memory
Compile time:
If you know at compile time where the process will reside in memory,
For example, if you know that a user process will reside starting at
location R, then the generated compiler code will start at that location
and extend up from there.
If, at some later time, the starting location changes, then it will be
Load time:
If it is not known at compile time where the process will reside
If the starting address changes, we need only reload the user
Execution time:
If the process can be moved during its execution from
work
Multistep Processing of a User Program
Logical vs. Physical Address Space
address
is never loaded
OS OS OS OS
process process process process
5 5 5 5
process process
9 9
process process
8 10
Internal fragmentation
Address Translation Scheme
Address generated by CPU is divided into:
Hierarchical Paging
4
1
3 2
4
<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
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
Segmentation Architecture (Cont.)
read/write/execute privileges
diagram
Address Translation Architecture
Example of Segmentation
Sharing of Segments
Segmentation with Paging –
MULTICS