20 + 21 Flashcards
What does memory management involve? What is the memory management unit?
The memory management unit is responsible for accessing main memory. Memory management deals with how to get processes into main memory and how it is organised?
What is address binding?
The process where symbols are converted to addresses. This can occur at compile time(can be absolute code if it is known where the process will reside in memory or relocatable code if this is not known.), link time(when linking separate modules)., load time, run time
What is dynamic linking and static linking? Which is better?
When a source program is compiled, code for functions provided by the language need to be incorporated. In static linking this is done before the program is executed. In dynamic linking it is only done at run-time(stub containing pointer is initialised when ran). Dynamic linking saves memory, load time, and makes updating libraries easier.
What are the pros and cons of the main methods for allocating contiguous memory space for a process image?
First-fit: take first free block that is big enough, this is quick but unlikely to be optimal.
Best-fit:Find free block that leaves smallest leftover, have to search whole set every time and end up creating lots of small holes.
Worst-fit: Find free block with most space left, still have to check every hole, no small holes, but may be harder to fit large processes.
All suffer from internal and external fragmentation.
What is external fragmentation? What about internal fragmentation
Enough memory in total, but no individual block small enough to accommodate process.
Internal fragmentation is when the allocated block is larger than the process image but the leftover is too small to be useful.
What is a logical and physical address? How do they work?
A logical address is mapped to a physical address(the one actually sent to memory unit) at run-time.
A logical address space of a process runs from 0 to the processes memory limit, the physical address space runs from 0 to the size of main memory.
This is mapped by the memory management unit (adding a number N to logical address, N is held in a relocation register).
What is paging?
A noncontiguous allocation method, in this a process’ logical address space is broken into fixed-size units called pages, main memory is broken into units of the same size, called frames. The logical addresses generated by the CPU contain a page number and an offset, a page table details which frame a page is stored in.
Why do page tables typically have an invalid/valid bit?
Page tables typically have more entries then a process has pages, the valid/invalid bit can be set to invalid for out-of-range memory references.
What are some key points on paging?
external fragmentation:none
internal fragmentation: average of half a page per process.
Page size: small, but want disk IO and housekeeping to still be low.
One page table per process.
OS keeps track of process’ page table via PCB.
How are page tables normally stored?
Keep a cache of recently used page table entries in associative registers(parallel access), store rest in main memory.
What is a segmentation allocation scheme?
Allow processes to partition their own address space.
What is swapping? Why is it good?
We can swap processes in and out of main memory in sync with CPU scheduling, allowing more processes to multitask.
What is partially loading processes? Why?
Don’t fully load the process into memory, use a dynamic loading/linking system to load a routine/function when it is called. This saves memory, increases possible multitasking and makes swapping processes in and out of memory during multitasking easier.
What is virtual memory?
Automates the loading of processes as they execute. Memory manager maps logical addresses to physical addresses and also loads physical pages into main memory from backing store.
What is demand paging?
do lazy swapping: only load page into memory once referenced by CPU. Often the invalid/valid bit is used to indicate if a page has been loaded.