4 Memory Management
4 Memory Management
4 Memory Management
❖ Background
❖ Swapping
❖ Contiguous Allocation
❖ Paging
❖ Segmentation
❖ Segmentation with Paging
Background
❖ Program must be brought into memory and placed within a
process for it to be run.
OS OS OS OS
process 8 process 10
Page # Frame #
10 10 12
Two-Level Paging Example
(Cont)
❖ Thus, a logical address is as follows:
page number page offset
pi p2 d
10 10 12
4
1
3 2
4
❖ Sharing.
– shared segments
– same segment number
❖ Allocation.
– first fit/best fit
– external fragmentation
Segmentation Architecture
(Cont.)
❖ Protection. With each entry in segment table associate:
– validation bit = 0 illegal segment
– 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
Segmentation with Paging –
MULTICS
❖ The MULTICS system solved problems of external
fragmentation and lengthy search times by paging the
segments.