Memory Management (PPT 5 - 6) Flashcards
Can we extend main memory using a hard disk?
Yes, this is virtual memory. However, it is still slow.
What governs memory address and register usage?
The program code being run.
Why use memory management?
The Operating System needs to allocate memory as efficiently as possible and keep track of those sector of memory which are free and which are in use (And what process is using each section)
What is memory management?
Management is needed to handle memory resources of a computer as efficiently as possible. It is partly static and partly dynamic and is governed by the OS, with hardware support from the processors.
What are the aims of memory management?
Primary function is to bring processes and data from secondary storage to main memory ready for execution. The following aims are desirable:
Protection
Sharing
Relocation
What is Sharing?
In a multi user and multi program environment, the same data can be used multiple times. It is therefore memory efficient if only one copy is stored and shared between processes.
What is Protection?
We need to prevent unauthorised programs accessing areas of memory allocated to other processes. This means the OS must protect processes (“Fence off” memory areas)
What is Relocation?
A process must be capable of being loaded into any part of the address space. This means data pointers and branch pointers within the program can be accessed in a relative way, using their base address (start address of the program), and a logical way, which is relative to the base address. This is done by the compiler
How is memory allocated?
When a process is loaded, it must be placed into memory as efficiently as possible. If insufficient free memory is available, we must remove another process to free memory.
What are the four partitioning schemes?
- Fixed Size Partition
- Variable Size Partition
- Segmentation
- Paging
What are Fixed Size Partitions?
When a process is loaded, it is placed into the smallest free partition which can fit all of it. If no segments are free, a process is then unloaded
What are the key points of Fixed Sized Partitions?
- There is always memory wasted at the end of a segment
- When a process is unloaded, the whole segment is freed
- Data structures can grow but there is a limit
What are Variable Size Partitions?
When a process is loaded in, it is placed in the first available partition which can fit all of it. If no segments are free, memory is unloaded.
What are the key points of Variable Size Partitions?
- No memory is wasted when loading processes
- As time goes on, memory becomes fragmented. Possible to defragment but this takes time.
What is Segmentation?
When a process is loaded in, it is itself segmented in order to fit into all available memory spaces