1.4 Memory Management Flashcards
Dynamic Memory Allocation
OS allows provides mechanism for programms to Dynamically allocate memory via system libraries and special functions
Memory Fragmentation
Inefficient splitting of memory space into small chunks in the main memory or on a hard disk.
Allocation Strategy
This is an algorithm that decides which free resource (here, memory region) is allocated to which request.
First Fit
- Allocate first free matching Block
- Simple and fast
But - Small free chunks accumulate at small adresses
Next fit
Same as first, but continue search at last allocation
Best fit
- Allocate the block that leaves the smallest reminder
But - Allocation of many small residual gaps
Worst fit
- Allocate the block that leaves the largest reminder
- Remaining gaps remain large and therefore easy to allocate
What is memory protection and why is it important?
Ensures that multiple processes are only accessing designated address space.
Process isolation
* Malfuntioning programs can only impact own address space
Data security
* Prevents unauthorized access to sensitive data
How is memory protection archieved?
Hardware support of the CPU
* Detects attempts
* Raises exception
* Triggers OS to stop process
Boundary registers
- Part of the CPU Check validity of memory address accessed by process
- Uses start and end information of process control block
Recap: What happens if process violates memory boundaries?
- Memory Access violation detected by Boundary registers via process control block
- Boundary registers promption CPU to hand over CPU to hand over control to OS
- Corrective action
Which part of the computer uses logical and which part physical addresses to acces memory?
- Address bus, physical
- CPU and programs, logical
Which part is doing the conversion of logical to physical addresses?
MMU
MMU
- MMU is part of the CPU
- Conversion of virtual to physical addresses
- Consists of two registers: Base register and Limit register
Base Register
- Stores starting physical address of programm memory space
- When programs logical address is generated, it assumes 0
- MMU adds value in base register to logical address to determine physical address