Add additional disclaimer to "diffstat"s.
[pintos-anon] / doc / vm.texi
index e44dacdc6ed30ccfb749777e1a18428f10040701..8ea6ee46b8c37b6897df3ddd365ed9428c731d1e 100644 (file)
@@ -213,6 +213,9 @@ could check and update the accessed and dirty bits for both addresses.
 Alternatively, the kernel could avoid the problem by only accessing user
 data through the user virtual address.
 
+Other aliases should only arise if you implement sharing, as extra
+credit (@pxref{VM Extra Credit}), or as bugs elsewhere in your code.
+
 @deftypefun bool pagedir_is_dirty (uint32_t *@var{pd}, const void *@var{vpage})
 @deftypefunx bool pagedir_is_accessed (uint32_t *@var{pd}, const void *@var{vpage})
 Returns true if page directory @var{pd} contains a page table entry for
@@ -476,7 +479,7 @@ script, so the code you turn in must properly handle all cases.
 Implement stack growth.  In project 2, the stack was a single page at
 the top of the user virtual address space, and programs were limited to
 that much stack.  Now, if the stack grows past its current size,
-allocate additional page as necessary.
+allocate additional pages as necessary.
 
 Allocate additional pages only if they ``appear'' to be stack accesses.
 Devise a heuristic that attempts to distinguish stack accesses from
@@ -556,6 +559,11 @@ implicitly or explicitly, all pages written to by the process are
 written back to the file, and pages not written must not be.  The pages
 are then removed from the process's list of virtual pages.
 
+Closing or removing a file does not unmap any of its mappings.  Once
+created, a mapping is valid until @code{munmap} is called or the process
+exits, following the Unix convention.  @xref{Removing an Open File}, for
+more information.
+
 If two or more processes map the same file, there is no requirement that
 they see consistent data.  Unix handles this by making the two mappings
 share the same physical page, but the @code{mmap} system call also has
@@ -572,9 +580,15 @@ Here's a summary of our reference solution, produced by the
 @command{diffstat} program.  The final row gives total lines inserted
 and deleted; a changed line counts as both an insertion and a deletion.
 
-This summary is relative to the Pintos base code, but we started from
-the reference solution to project 2.  @xref{Project 2 FAQ}, for the
-summary of project 2.
+This summary is relative to the Pintos base code, but the reference
+solution for project 3 starts from the reference solution to project 2.
+@xref{Project 2 FAQ}, for the summary of project 2.
+
+The reference solution represents just one possible solution.  Many
+other solutions are also possible and many of those differ greatly from
+the reference solution.  Some excellent solutions may not modify all the
+files modified by the reference solution, and some may modify files not
+modified by the reference solution.
 
 @verbatim
  Makefile.build       |    4 
@@ -602,6 +616,7 @@ summary of project 2.
 Yes.
 
 @item What extra credit is available?
+@anchor{VM Extra Credit}
 
 You may implement sharing: when multiple processes are created that use
 the same executable file, share read-only pages among those processes
@@ -643,6 +658,12 @@ you like, but it should be the underlying mechanism.
 Also, you can use the @option{-u} option to @command{pintos} to limit
 the size of the user pool, which makes it easy to test your VM
 implementation with various user memory sizes.
+
+@item Data pages might need swap space.  Can I swap them out at process load?
+
+No.  Reading data pages from the executable and writing them to swap
+immediately at program startup is not demand paging.  You need to demand
+page everything (except partial pages).
 @end table
 
 @node Memory Mapped File FAQ
@@ -696,14 +717,4 @@ munmap (map);
 
 The @command{mcp} program in @file{src/examples} shows how to copy a
 file using memory-mapped I/O.
-
-@item What happens if a user removes a @code{mmap}'d file?
-
-The mapping should remain valid, following the Unix convention.
-@xref{Removing an Open File}, for more information.
-
-@item If a user closes a mapped file, should it be automatically unmapped?
-
-No.  Once created the mapping is valid until @code{munmap} is called
-or the process exits.
 @end table