Memory Management: Background Swapping Contiguous Allocation Paging Segmentation Segmentation With Paging
Memory Management: Background Swapping Contiguous Allocation Paging Segmentation Segmentation With Paging
Background
Swapping
Contiguous Allocation
Paging
Segmentation
Segmentation with Paging
Background
never loaded.
Useful when large amounts of code are needed to
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
page table.
In this scheme every data/instruction access requires two
memory accesses. One for the page table and one for the
data/instruction.
The two memory access problem can be solved by the use
10 10 12
Each element consists of three fields: (a) the virtual page number,
(b) the value of he mapped page frame, and (c) a pointer to the next
element in the linked list.
The virtual page number in the virtual address is hashed into the
hash table. The virtual page number is compared to field (a) in the
first element in the linked list. If there is a match, the corresponding
page frame (field (b)) is used to form the desired physical address.
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
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.