Update.
[pintos-anon] / doc / vm.texi
index 37769f9acc1cf7192fbeed337a886e860449f6e7..f922810e17baa5eb93e897542d08b636790ed6a6 100644 (file)
@@ -412,11 +412,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.
 
 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.
+You must write your code so that we can choose a page replacement
+policy at Pintos startup time.  By default, the LRU-like algorithm
+must be in effect, but we must be able to choose random replacement by
+invoking @command{pintos} with the @option{-o random-paging} option.
+Passing this option sets @code{enable_random_paging}, declared in
+@file{threads/init.h}, to true.
 
 Since you will already be paging from disk, you should implement a
 ``lazy'' loading scheme for new processes.  When a process is created,
 
 Since you will already be paging from disk, you should implement a
 ``lazy'' loading scheme for new processes.  When a process is created,
@@ -460,7 +461,7 @@ such as Linux do not load partial pages lazily.
 
 Incidentally, if you have trouble handling the third case above, you
 can eliminate it temporarily by linking the test programs with a
 
 Incidentally, if you have trouble handling the third case above, you
 can eliminate it temporarily by linking the test programs with a
-special ``linker script.''  Read @file{tests/userprog/Makefile} for
+special ``linker script.''  Read @file{Makefile.userprog} for
 details.  We will not test your submission with this special linker
 script, so the code you turn in must properly handle all cases.
 
 details.  We will not test your submission with this special linker
 script, so the code you turn in must properly handle all cases.
 
@@ -533,12 +534,12 @@ Yes.
 @anchor{Hash Table}
 @b{How do I use the hash table provided in @file{lib/kernel/hash.c}?}
 
 @anchor{Hash Table}
 @b{How do I use the hash table provided in @file{lib/kernel/hash.c}?}
 
-First, you need to embed a @code{hash_elem} object as a member of the
-object that the hash table will contain.  Each @code{hash_elem} allows
+First, you need to embed a @struct{hash_elem} as a member of the
+object that the hash table will contain.  Each @struct{hash_elem} allows
 the object to a member of at most one hash table at a given time.  All
 the hash table functions that deal with hash table items actually use
 the object to a member of at most one hash table at a given time.  All
 the hash table functions that deal with hash table items actually use
-the address of a @code{hash_elem}.  You can convert a pointer to a
-@code{hash_elem} member into a pointer to the structure in which
+the address of a @struct{hash_elem}.  You can convert a pointer to a
+@struct{hash_elem} member into a pointer to the structure in which
 member is embedded using the @code{hash_entry} macro.
 
 Second, you need to decide on a key type.  The key should be something
 member is embedded using the @code{hash_entry} macro.
 
 Second, you need to decide on a key type.  The key should be something
@@ -553,11 +554,11 @@ to be compatible with the prototypes for @code{hash_hash_func} and
 @code{hash_less_func} in @file{lib/kernel/hash.h}.
 
 Here's a quick example.  Suppose you want to put @struct{thread}s
 @code{hash_less_func} in @file{lib/kernel/hash.h}.
 
 Here's a quick example.  Suppose you want to put @struct{thread}s
-in a hash table.  First, add a @code{hash_elem} to the thread
+in a hash table.  First, add a @struct{hash_elem} to the thread
 structure by adding a line to its definition:
 
 @example
 structure by adding a line to its definition:
 
 @example
-hash_elem h_elem;               /* Hash table element. */
+struct hash_elem h_elem;                /* Hash table element. */
 @end example
 
 We'll choose the @code{tid} member in @struct{thread} as the key,
 @end example
 
 We'll choose the @code{tid} member in @struct{thread} as the key,
@@ -566,7 +567,7 @@ and write a hash function and a comparison function:
 @example
 /* Returns a hash for E. */
 unsigned
 @example
 /* Returns a hash for E. */
 unsigned
-thread_hash (const hash_elem *e, void *aux UNUSED)
+thread_hash (const struct hash_elem *e, void *aux UNUSED)
 @{
   struct thread *t = hash_entry (e, struct thread, h_elem);
   return hash_int (t->tid);
 @{
   struct thread *t = hash_entry (e, struct thread, h_elem);
   return hash_int (t->tid);
@@ -574,7 +575,7 @@ thread_hash (const hash_elem *e, void *aux UNUSED)
 
 /* Returns true if A's tid is less than B's tid. */
 bool
 
 /* Returns true if A's tid is less than B's tid. */
 bool
-thread_less (const hash_elem *a_, const hash_elem *b_, 
+thread_less (const struct hash_elem *a_, const struct hash_elem *b_, 
              void *aux UNUSED)
 @{
   struct thread *a = hash_entry (a_, struct thread, h_elem);
              void *aux UNUSED)
 @{
   struct thread *a = hash_entry (a_, struct thread, h_elem);