tailieunhanh - Lecture Operating system concepts - Chapter 10: Virtual memory
Virtual memory can be a very interesting subject since it has so many different aspects: page faults, managing the backing store, page replacement, frame allocation, thrashing, page size. The objectives of this chapter are to explain these concepts and show how paging works. | Chapter 10: Virtual Memory I Background I Demand Paging I Process Creation I Page Replacement I Allocation of Frames I Thrashing I Operating System Examples Operating System Concepts Silberschatz, Galvin and Gagne 2002 Background I 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. I Virtual memory can be implemented via: ✦ Demand paging ✦ Demand segmentation Operating System Concepts Silberschatz, Galvin and Gagne 2002 Virtual Memory That is Larger Than Physical Memory Operating System Concepts Silberschatz, Galvin and Gagne 2002 Demand Paging I Bring a page into memory only when it is needed. ✦ Less I/O needed ✦ Less memory needed ✦ Faster response ✦ More users I Page is needed Þ reference to it ✦ invalid reference Þ abort ✦ not-in-memory Þ bring to memory Operating System Concepts Silberschatz, Galvin and Gagne 2002 Transfer of a Paged Memory to Contiguous Disk Space Operating System Concepts Silberschatz, Galvin and Gagne 2002 Valid-Invalid Bit I With each page table entry a valid–invalid bit is associated (1 Þ in-memory, 0 Þ not-in-memory) I Initially valid–invalid but is set to 0 on all entries. I Example of a page table snapshot. Frame # valid-invalid bit 1 1 1 1 0 M 0 0 page table I During address translation, if valid–invalid bit in page table entry is 0 Þ page fault. Operating System Concepts Silberschatz, Galvin and Gagne 2002 Page Table When Some Pages Are Not in Main Memory Operating System Concepts Silberschatz, Galvin and Gagne 2002 Page Fault I If there is ever a reference to a page, first reference will trap to OS Þ page fault I OS looks at another table to decide: ✦ Invalid reference Þ abort. ✦ Just
đang nạp các trang xem trước