9, 10 Flashcards
What are the four functional requirements of a memory manager?
Abstraction
Allocation
Isolation
Memory Sharing
What is the purpose of abstraction in a memory manager?
How does abstraction handle memory addresses?
To make the memory management (MM) appear larger than the physical machine memory and present it as an array of contiguously addressed bytes.
It uses an abstract set of logical addresses to reference physical memory.
What is the allocation function of a memory manager?
To allocate primary memory to processes as requested.
What is the role of isolation in memory management?
To enable mutually exclusive use of memory by processes, ensuring no interference between them.
How does the memory manager handle memory sharing?
It enables memory to be shared by processes when required
When is swapping used in memory management?
How does the operating system perform swapping?
Where is the swapped-out process stored?
Swapping is used when a program must be loaded into main memory (MM) but there is not enough room, so another process is moved to secondary storage to make room.
The OS selects a process to swap out and replaces it with another process from secondary storage. Only parts of the process space not already on disk are swapped out.
Swapped-out processes can be stored either in an arbitrary file, which introduces file management overhead, or in a special partition on the disk called the swap space, which is more efficient.
What does the compiler/linker do during process creation regarding memory addresses?
How does the memory management subsystem handle processes loaded into physical memory?
It associates logical addresses to every instruction and data.
The subsystem decides what to load, when, and where. It translates logical addresses to physical addresses for each process in memory.
How is a virtual address translated into a physical address in main memory?
The physical address is calculated by adding the start address of the process in physical memory to the virtual address of the data. ‘
For example, if the start address is 0x61000 and the virtual address is 0xA11, the physical address is 0x61A11.
What is memory paging?
Memory paging divides the process address space into segments of identical sizes called pages.
These pages are mapped to page frames of the same size in main memory, enabling non-contiguous storage.
What are the advantages of memory paging?
No external fragmentation.
Programs don’t need to be stored contiguously.
Internal fragmentation is limited to the size of one page.
Only the required pages are loaded into memory.
How is a process stored in main memory using paging?
A process is divided into pages, each loaded into any free page frame in main memory. The size of a page equals the size of a page frame.
What is internal fragmentation in paging?
Internal fragmentation occurs when the last page of a process does not completely fill a page frame, leading to wasted memory space.
Example Scenario:
Assume main memory has 1300 lines, each page/frame has 100 lines, and the OS requires 280 lines. If Process P1 requires 350 lines, how many free frames remain?
The OS uses 3 frames (280 lines), and Process P1 uses 4 frames (350 lines). There are 13 total frames in memory, leaving 6 free frames.
What are the remaining challenges in memory paging?
Keeping track of where pages are stored.
Providing a mechanism for address binding (logical to physical address translation).
Deciding which pages to load into main memory and when.
What are “pages” and “page frames” in memory paging?
Pages are segments of a process’s address space, while page frames are segments of main memory.
Each page maps to a page frame for storage.
What is the purpose of a page table in memory paging?
The page table keeps track of which box (page) of each pallet (process) is located on which shelf (frame) in secondary storage.
What is one solution for keeping track of where pages are stored in memory paging?
Where is the address of the page table saved?
What is an advantage of this solution?
What is a disadvantage?
Maintaining a page table for each process
In the process’ process control block PCB
Easy to find a page in main memory, requiring only a single look-up in the page table.
Consumes a lot of memory if each process has tens of thousands of pages.
What is another solution for keeping track of where pages are stored in memory paging?
Maintaining a single inverted page table, also called a frame table.