Segmentation Flashcards
What is the only storage that the CPU can access directly?
Main memory and registers
What is swapping
-saving a program’s state on background storage (roll-out)
-replacing it with another program’s state (roll-in)
+ only needs hardware support to protect the kernel
- very slow
-no parallelism
Static relocation
-The OS adds a fixed offset to every address in a program when loading it and creating a process from it
-Same address space for every process
> no protection: every program sees and can access every address
Desired properties when sharing physical memory
- protection: a bug in one process mustn’t corrupt memory in another
- transparency: a process shouldn’t require particular physical memory addresses
-resource exhaustion: allow that the sum of sizes of all processes is greater than physical memory
Base and Limit registers advantages and disadvantages
+ straightforward to implement MMU
+ very quick at run-time
- can’t grow a process’ address space
- can’ share code or data
Segmentation trade-offs
+ dynamic relocation is possible
+ makes data/code sharing between processes possible without compromising
+ process doesn’t need one large contiguous physical memory area
+ don’t need entire process in memory
-segments need to be kept contiguous in physical memory
- fragmentation of physical memory
Fragmentation, internal, external
Fragmentation: Inability to use free memory
Internal: Overallocate resource requests to align memory blocks. No free blocks left although there is sufficient unused memory within the blocks
External: Sum of free space is sufficient but can’t allocate sufficiently large contiguous block of free memory
Difference between a virtual and a physical address
- in systems with no fixed 1:1 mapping of the applications’ addresses to the physical addresses
- each executable program belongs to a virtual address space
- during execution parts of the programs are mapped to physical memory
When is compaction a viable option to reduce external fragmentation
If all references to moved memory blocks can be updated
Compaction may not be used for memory blocks allocated on the heap (with malloc), because it can’t reduce external fragmentation in a native heap as the heap is not able to reliably track and update all pointers to the allocated memory.
What is the benefit of using virtual addresses instead of physical
That allows the OS to freely organize the physical address space and to protect itself from processes and isolating processes from each other, by configuring the virtual-to-physical mapping appropriately.
Adding the same mapping to more than one process also allows for convenient and fast sharing of memory
How does MMU determine where the segment table is located in memory
it has two registers:
1. contains the physical address of the segment table
2. specifies the size of the table