Why must memory be allocated carefully?
To ensure a reasonable supply of ready processes to consume available processor time.
List the five memory management requirements.
Relocation, protection, sharing, logical organisation, physical organisation.
Why is relocation needed?
The programmer does not know where the program will be placed; it may be swapped to disk and return to main memory at a different location, so references must be translated to the actual physical address.
Why must memory protection be checked at run time?
Because it is impossible to check absolute addresses at compile time.
What is overlaying, and its drawback?
It allows various modules to be assigned the same region of memory, but it is time consuming to program.
Frame vs page vs segment.
Frame: fixed-length block of main memory. Page: fixed-length block of data in secondary memory. Segment: variable-length block of data in secondary memory.
What has virtual memory evolved from?
From the partitioning methods.
Two problems of equal-size fixed partitioning.
A program may not fit (needs overlays); memory use is inefficient — any program, however small, occupies an entire partition (internal fragmentation).
Placement with unequal-size fixed partitions.
Assign each process to the smallest partition within which it will fit (a queue for each partition), minimizing wasted memory within a partition.
Remaining problems with fixed partitions.
The number of active processes is limited by the pre-determined number of partitions; many very small processes will not use the space efficiently.
How much memory does a process get with dynamic partitioning?
Exactly as much memory as required (partitions are of variable length and number).
External fragmentation and its remedy.
Memory external to all processes is fragmented; it can be resolved using compaction (the OS moves processes so they are contiguous), which is time consuming and wastes CPU time.
Best-fit: how does it choose, and how does it perform?
The block closest in size to the request; it is the worst performer overall — it leaves the smallest fragments, so compaction must be done more often.
Which placement algorithm is the fastest?
First-fit (scans from the beginning and chooses the first block that is large enough).
Next-fit: where does it scan from, and what does it break up?
From the location of the last placement; it often allocates at the end of memory, breaking up the largest block into smaller blocks.
Logical vs relative vs physical address.
Logical: independent of the current assignment of data to memory. Relative: relative to some known point. Physical/absolute: the actual location in main memory.
What do the base and bounds registers hold?
Base: the starting address for the process. Bounds: the ending location of the process. Set when the process is loaded or swapped in.
How is an absolute address produced and checked at run time?
Base register + relative address = absolute address; it is compared with the bounds register; if not within bounds, an interrupt is generated to the OS.
Simple paging: what are pages and frames?
Memory is partitioned into equal fixed-size chunks (frames) and each process into chunks of the same size (pages); page size = frame size.
What does a process page table contain?
The frame location for each page in the process.
Segmentation addressing and its similarity.
An address is a segment number and an offset; segmentation is similar to dynamic partitioning.