Operating System Unit 3 Part 1
Operating System Unit 3 Part 1
UNIT 3 PART 1
Memory Management
• It is the functionality of an OS which manages
primary memory and moves process back b/w
main memory and disk.
• Function of Memory Management
• keep track of every memory location
• Tracks of whether memory is allocated or not
• Track how much memory is allocated
• Takes decision which process will get memory and
when.
Goal of Memory Management
• Space utilization
Fragmentation-memory loss can occur
Try to keep Fragmentation as low as possible
• Run larger program in small memory area
achieves by virtual memory
Base and Limit Registers
A pair of base and limit registers
define the logical address space Fence address
Base Limit P1
.
Y
.
CPU
CPU
+ < .
Address N Memory .
Address
P2
Trap
Pn
High
Swapping
• A process can be swapped temporarily out of memory to a
backing store, and then brought back into memory for
continued execution
• Backing store – fast disk large enough to accommodate copies
of all memory images for all users must provide direct access
to these memory images
• Roll out, roll in – swapping variant used for priority-based
scheduling algorithms, lower-priority process is swapped out
so higher-priority process can be loaded and executed
• Major part of swap time is transfer time, total transfer time is
directly proportional to the amount of memory swapped
• System maintains a ready queue of ready-to-run processes
which have memory images on disk
Schematic View of Swapping
Contiguous Allocation!
Kernel Low
Y .
Y
CPU > < .
.
CPU
Memory .
Address N N
Address
Trap P2
Trap
Pn
High