Memory Management
Memory Management
Technology
Memory Management
Background, Basic Concepts
Major part of swap time is transfer time; total transfer time is directly
proportional to the amount of memory swapped.
• Single-partition allocation
– Relocation-register scheme used to protect user processes
from each other, and from changing operating-system code
and data.
– Relocation register contains value of smallest physical
address; limit register contains range of logical addresses –
each logical address must be less than the limit register.
Hardware Support for Relocation and
Limit Registers
Contiguous Allocation (Cont.)
• Multiple-partition allocation
– Hole – block of available memory; holes of various size
are scattered throughout memory.
– When a process arrives, it is allocated memory from a
hole large enough to accommodate it.
– Operating system maintains information about:
a) allocated partitions b) free partitions (hole)
OS OS OS OS
process 8 process 10
19
Fragmentation
Page # Frame #
• Hierarchical Paging
10 10 12
Thus, a logical address is as follows:
where pi is an index into the outer page table, and p2 is the
displacement within the page of the outer page table.
Two-Level Page-Table Scheme
Address-Translation Scheme
• Shared code
– One copy of read-only (reentrant) code shared among
processes (i.e., text editors, compilers, window systems).
– Shared code must appear in same location in the logical
address space of all processes.
1
1 4
2
3
4 2
Relocation.
dynamic
by segment table
Sharing.
shared segments
same segment number
Allocation.
first fit/best fit
external fragmentation
Segmentation Architecture (Cont.)