Memory Management Flashcards
What are the 3 memory management tasks
- Memory allocation
- Protection
- Sharing
What is memory allocation
Memory management techniques need to allocate memory to processes in an efficient way.
What is protection in memory management
All processes need to be protected against interference from other processes.
What is sharing in memory management
Processes may sometimes need to share data.
What are the 6 memory management techniques
1 fixed partitioning
2 dynamic partitioning
3 simple segmentation
4 virtual memory segmentation
5 simple paging
6 virtual memory paging
What is fixed partitioning
- Memory is divided into partitions of a fixed size; the size may vary between partitions
- A process can be loaded into any partition whose size is equal to or greater than the size of the process
- One-to-one mapping between partitions and processes
What is internal Fragmentation
Internal fragmentation refers to wasted space inside partitions when the size of the process is smaller than the size of the partition.
What are the pros of fixed partitioning
Easy to understand and implement
What are the cons of fixed partitioning
- Internal fragmentation
- A pre-specified upper limit on the number of processes
- A pre-specified upper limit on the size of the largest process
How does dynamic partitioning work
- The partition sizes adjust to the sizes of processes
- One-to-one mapping between partitions and processes
What does external fragmentation refer too
External fragmentation refers to wasted space in between partitions.
What does compaction refer to
to methods for relocating processes so that they occupy contiguous memory regions, thereby consolidating all free memory into a single contiguous block.
What are the pros of dynamic partitioning
- No internal fragmentation
- No limit on the number of processes or on the size of the largest process
What are the cons of dynamic partitioning
- External fragmentation
- Time is wasted on compaction
How does simple segmentation work
- Each program is divided into segments (e.g., text and data segments)
- Segments are loaded into memory as in dynamic partitioning
- All segments need to be loaded into memory, but they do not need to be contiguous
What are the pros of simple segmentation
- Easier to fit processes in memory than with dynamic partitioning
- No internal fragmentation
- No limit on the number of processes or on the size of the largest process
What are the cons of simple segmentation
- External fragmentation (less than dynamic partitioning)
- Time is wasted on compaction
What is virtual memory segmentation
Virtual memory refers to the use of disk storage as if it was main memory
How does virtual memory segmentation work
Segments are loaded into memory as in dynamic partitioning, except that not all segments need to be loaded at the same time
What are the pros of visual memory segmentation
- Easier to fit processes in memory than with simple segmentation
- No internal fragmentation
- No limit on the number of processes or on the size of the largest process
What are the cons of virtual memory segmentation
- More overhead required for virtual memory
- External fragmentation (less than dynamic partitioning)
- Time is wasted on compaction
Explain simple paging
Memory is divided into fixed-size frames of equal size
* Each process is divided into pages of the same size
* Internal fragmentation is small since
- it only affects the last frame of each process
- the frame/page-size is fairly small
What are the pros of simple paging
- No external fragmentation
- All pages fit perfectly into frames
What are the cons of simple paging
- (small) Internal fragmentation
- Each process requires a page table (which consumes memory)
What is virtual memory paging
Pages are loaded into frames as in simple paging, except that not all pages need to be loaded at the same time.
What are the pros of visual memory paging
- Easier to fit processes in memory than with simple paging
- No external fragmentation
- All pages fit perfectly into frames
What are the cons of virtual memory paging
- More overhead required for virtual memory
- (small) Internal fragmentation
- Each process requires a page tables (which consumes memory)
Protection and sharing segmentation and paging
Protection/sharing is generally easier with segmentation than with paging since
- the segment table is smaller than the page table
- segments are more natural units for protection/sharing