Professional Documents
Culture Documents
Main Memory: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edition
Main Memory: Silberschatz, Galvin and Gagne ©2013 Operating System Concepts - 9 Edition
Main Memory
Operating System Concepts – 9th Edition Silberschatz, Galvin and Gagne ©2013
Memory Management
Background
Swapping
Contiguous Memory Allocation
Segmentation
Paging
Structure of the Page Table
Example: The Intel 32 and 64-bit Architectures
Example: ARM Architecture
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
Best-fit:
Worst-fit:
212K is put in 300K partition
212K is put in 600K partition
417K is put in 500K partition
417K is put in 500K partition
112K is put in 200K partition
112K is put in 388K partition
426K is put in 600K partition
426K must wait
External Fragmentation
Internal Fragmentation
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
The virtual page number in the virtual address is hashed into the
hash table. The virtual page number is compared to field (1) in the
first element in the linked list. If there is a match, the corresponding
page frame (field (2)) 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.