X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=doc%2Fvm.texi;h=260f9d99c751fce1a3c211e04cbd9119be7f202a;hb=1b47a133b4d374666143ad9636b3270ef79757f0;hp=ef2eb80050c77efc5b08cdc5da6f6696e35aed2d;hpb=13edd557eb3fc3e7b0505e6364bbde5f152247c3;p=pintos-anon diff --git a/doc/vm.texi b/doc/vm.texi index ef2eb80..260f9d9 100644 --- a/doc/vm.texi +++ b/doc/vm.texi @@ -273,11 +273,6 @@ Some way of translating in software from virtual page frames to physical page frames. Consider using a hash table (@pxref{Hash Table}). -@item -Some way of translating from physical page frames back to virtual page -frames, so that when you evict a physical page from its frame, you can -invalidate its translation(s). - It is possible to do this translation without adding a new data structure, by modifying the code in @file{userprog/pagedir.c}. However, if you do that you'll need to carefully study and understand section 3.7 @@ -288,6 +283,15 @@ data structure. Some way of finding a page on disk if it is not in memory. You won't need this data structure until problem 3-2, but planning ahead is a good idea. + +You can generalize the virtual-to-physical page table, so that it allows +you to locate a page wherever it is in physical memory or on disk, or +you can make this a separate table. + +@item +Some way of translating from physical page frames back to virtual page +frames, so that when you evict a physical page from its frame, you can +invalidate its translation(s). @end itemize The page fault handler, @func{page_fault} in @@ -370,6 +374,12 @@ pages less frequently using your algorithm than using some inferior page replacement policy. The canonical example of a poor page replacement policy is random replacement. +You must write your code so that we can choose a page replacement policy +at compile time. By default, the LRU-like algorithm must be in effect, +but we must be able to choose random replacement by inserting the line +@code{#define RANDOM_REPLACEMENT 1} in @file{constants.h}. +@xref{Conditional Compilation}, for details. + Since you will already be paging from disk, you should implement a ``lazy'' loading scheme for new processes. When a process is created, it will not run immediately. Therefore, it doesn't make sense to load