Professional Documents
Culture Documents
• Background
• Demand Paging
• Process Creation
• Page Replacement
• Allocation of Frames
• Thrashing
• Operating System Examples
Background
• Virtual memory – separation of user logical memory
from physical memory.
– Only part of the program needs to be in memory for
execution.
– Logical address space can therefore be much larger than
physical address space.
– Allows address spaces to be shared by several processes.
– Allows for more efficient process creation.
Operating System
Concepts
Virtual Memory That is Larger Than Physical Memory
Operating System
Concepts
Demand Paging
• Bring a page into memory only when it is needed.
– Less I/O needed
– Less memory needed
– Faster response
– More users
Operating System
Concepts
Transfer of a Paged Memory to Contiguous Disk Space
Operating System
Concepts
Valid-Invalid Bit
• With each page table entry a valid–invalid bit is associated
(1 in-memory, 0 not-in-memory)
• Initially valid–invalid bit is set to 0 on all entries.
Frame # valid-invalid bit
• Example of a page table snapshot.
1
1
1
1
0
0
0
• During address translation, if valid–invalid bit in page table entry
is 0 page fault.
page table
Operating System
Concepts
Page Table When Some Pages Are Not in Main Memory
Operating System
Concepts
Page Fault
• If there is ever a reference to a page, first reference will trap to
OS page fault
• OS looks at another table to decide:
– Invalid reference abort.
– Just not in memory.
• Get empty frame.
• Swap page into frame.
• Reset tables, validation bit = 1.
• Restart instruction: Least Recently Used
– block move
Operating System
Concepts
Steps in Handling a Page Fault
Operating System
Concepts
What happens if there is no free frame?
processes