27-11-2012, 04:05 PM
Operating Systems
Operating Systems.ppt (Size: 277 KB / Downloads: 179)
Analysis of External Fragmentation
Assume:
system at equilibrium
process in middle
if N processes, 1/2 time process, 1/2 hole
==> 1/2 N holes!
Fifty-percent rule
Fundamental:
adjacent holes combined
adjacent processes not combined
Compaction
Shuffle memory contents to place all free memory together in one large block
Only if relocation dynamic!
Same I/O DMA problem
Paging
Logical address space noncontiguous; process gets memory wherever available
Divide physical memory into fixed-size blocks
size is a power of 2, between 512 and 8192 bytes
called Frames
Divide logical memory into bocks of same size
called Pages
Paging Tradeoffs
Advantages
no external fragmentation (no compaction)
relocation (now pages, before were processes)
Disadvantages
internal fragmentation
consider: 2048 byte pages, 72,766 byte proc
35 pages + 1086 bytes = 962 bytes
avg: 1/2 page per process
small pages!
overhead
page table / process (context switch + space)
lookup (especially if page to disk)
Memory Management in Linux
Page size:
Alpha AXP has 8 Kbyte page
Intel x86 has 4 Kbyte page
Segments
Kernel code, kernel data, user code, user data …
Multilevel paging (3 levels)
Makes code more portable
Even though no hardware support on x86!
“middle-layer” defined to be 0