Update docs.
[pintos-anon] / doc / vm.texi
1 @node Project 3--Virtual Memory, Project 4--File Systems, Project 2--User Programs, Top
2 @chapter Project 3: Virtual Memory
3
4 By now you should be familiar with the inner workings of Pintos.
5 You've already come a long way: your OS can properly handle multiple
6 threads of execution with proper synchronization, and can load
7 multiple user programs at once.  However, when loading user programs,
8 your OS is limited by how much main memory the simulated machine has.
9 In this assignment, you will remove that limitation.
10
11 You will be using the @file{vm} directory for this project.  There is
12 no new code to get acquainted with for this assignment.  The @file{vm}
13 directory contains only the @file{Makefile}s.  The only change from
14 @file{userprog} is that this new @file{Makefile} turns on the setting
15 @option{-DVM}, which you will need for this assignment.  All code you
16 write will either be newly generated files (e.g.@: if you choose to
17 implement your paging code in their own source files), or will be
18 modifications to pre-existing code (e.g.@: you will change the
19 behavior of @file{addrspace.c} significantly).
20
21 You will be building this assignment on the last one.  It will benefit
22 you to get your project 2 in good working order before this assignment
23 so those bugs don't keep haunting you.
24
25 All the test programs from the previous project should also work with
26 this project.  You should also write programs to test the new features
27 introduced in this project.
28
29 @menu
30 * VM Design::                   
31 * Page Faults::                 
32 * Disk as Backing Store::       
33 * Memory Mapped Files::         
34 * Stack::                       
35 * Problem 3-1 Page Table Management::  
36 * Problem 3-2 Paging To and From Disk::  
37 * Problem 3-3 Memory Mapped Files::  
38 * Virtual Memory FAQ::          
39 @end menu
40
41 @node VM Design
42 @section A Word about Design
43
44 It is important for you to note that in addition to getting virtual
45 memory working, this assignment is also meant to be an open-ended
46 design problem.  We will expect you to come up with a design that
47 makes sense.  You will have the freedom to choose how to do software
48 translation on TLB misses, how to represent the swap partition, how to
49 implement paging, etc.  In each case, we will expect you to provide a
50 defensible justification in your design documentation as to why your
51 choices are reasonable.  You should evaluate your design on all the
52 available criteria: speed of handling a page fault, space overhead in
53 memory, minimizing the number of page faults, simplicity, etc.
54
55 In keeping with this, you will find that we are going to say as little
56 as possible about how to do things.  Instead we will focus on what end
57 functionality we require your OS to support.
58
59 @node Page Faults
60 @section Page Faults
61
62 For the last assignment, whenever a context switch occurred, the new
63 process would install its own page table into the machine.  The page
64 table contained all the virtual-to-physical translations for the
65 process.  Whenever the processor needed to look up a translation, it
66 consulted the page table.  As long as the process only accessed
67 memory that it didn't own, all was well.  If the process accessed
68 memory it didn't own, it ``page faulted'' and @code{page_fault()}
69 terminated the process.
70
71 When we implement virtual memory, the rules have to change.  A page
72 fault is no longer necessarily an error, since it might only indicate
73 that the page must be brought in from a disk file or from swap.  You
74 will have to implement a more sophisticated page fault handler to
75 handle these cases.
76
77 On the 80@var{x}86, the page table format is fixed by hardware.  The
78 top-level data structure is a 4 kB page called the ``page directory''
79 (PD) arranged as an array of 1,024 32-bit page directory entries
80 (PDEs), each of which represents 4 MB of virtual memory.  Each PDE may
81 point to the physical address of another 4 kB page called a ``page
82 table'' (PT) arranged in the same fashion as an array of 1,024 32-bit
83 page table entries (PTEs), each of which translates a single 4 kB
84 virtual page into physical memory.
85
86 Thus, translation of a virtual address into a physical address follows
87 the three-step process illustrated in the diagram
88 below:@footnote{Actually, virtual to physical translation on the
89 80@var{x}86 architecture happens via an intermediate ``linear
90 address,'' but Pintos (and most other 80@var{x}86 OSes) set up the CPU
91 so that linear and virtual addresses are one and the same, so that you
92 can effectively ignore this CPU feature.}
93
94 @enumerate 1
95 @item
96 The top 10 bits of the virtual address (bits 22:31) are used to index
97 into the page directory.  If the PDE is marked ``present,'' the
98 physical address of a page table is read from the PDE thus obtained.
99 If the PDE is marked ``not present'' then a page fault occurs.
100
101 @item
102 The next 10 bits of the virtual address (bits 12:21) are used to index
103 into the page table.  If the PTE is marked ``present,'' the physical
104 address of a data page is read from the PTE thus obtained.  If the PTE
105 is marked ``not present'' then a page fault occurs.
106
107
108 @item
109 The bottom 12 bits of the virtual address (bits 0:11) are added to the
110 data page's physical base address, producing the final physical
111 address.
112 @end enumerate
113
114 @example
115 32                    22                     12                      0
116 +--------------------------------------------------------------------+
117 | Page Directory Index |   Page Table Index   |    Page Offset       |
118 +--------------------------------------------------------------------+
119              |                    |                     |
120      _______/             _______/                _____/
121     /                    /                       /
122    /    Page Directory  /      Page Table       /    Data Page
123   /     .____________. /     .____________.    /   .____________.
124   |1,023|____________| |1,023|____________|    |   |____________|
125   |1,022|____________| |1,022|____________|    |   |____________|
126   |1,021|____________| |1,021|____________|    \__\|____________|
127   |1,020|____________| |1,020|____________|       /|____________|
128   |     |            | |     |            |        |            |
129   |     |            | \____\|            |_       |            |
130   |     |      .     |      /|      .     | \      |      .     |
131   \____\|      .     |_      |      .     |  |     |      .     |
132        /|      .     | \     |      .     |  |     |      .     |
133         |      .     |  |    |      .     |  |     |      .     |
134         |            |  |    |            |  |     |            |
135         |____________|  |    |____________|  |     |____________|
136        4|____________|  |   4|____________|  |     |____________|
137        3|____________|  |   3|____________|  |     |____________|
138        2|____________|  |   2|____________|  |     |____________|
139        1|____________|  |   1|____________|  |     |____________|
140        0|____________|  \__\0|____________|  \____\|____________|
141                            /                      /
142 @end example
143
144 @node Disk as Backing Store
145 @section Disk as Backing Store
146
147 In VM systems, since memory is less plentiful than disk, you will
148 effectively use memory as a cache for disk.  Looking at it from
149 another angle, you will use disk as a backing store for memory.  This
150 provides the abstraction of an (almost) unlimited virtual memory size.
151 Part of your task in this project is to do this, with the additional
152 constraint that your performance should be close to that provided by
153 physical memory.  You will use the page tables' ``dirty'' bits to
154 denote whether pages need to be written back to disk when they're
155 evicted from main memory and the ``accessed'' bit for page replacement
156 algorithms.  Whenever the hardware writes memory, it sets the dirty
157 bit, and if it reads or writes to the page, it sets the accessed bit.
158
159 As with any caching system, performance depends on the policy used to
160 decide which things are kept in memory and which are only stored on
161 disk.  On a page fault, the kernel must decide which page to replace.
162 Ideally, it will throw out a page that will not be referenced for a
163 long time, keeping in memory those pages that are soon to be
164 referenced.  Another consideration is that if the replaced page has
165 been modified, the page must be first saved to disk before the needed
166 page can be brought in.  Many virtual memory systems avoid this extra
167 overhead by writing modified pages to disk in advance, so that later
168 page faults can be completed more quickly.
169
170 @node Memory Mapped Files
171 @section Memory Mapped Files
172
173 The traditional way to access the file system is via @code{read} and
174 @code{write} system calls, but that requires an extra level of copying
175 between the kernel and the user level.  A secondary interface is
176 simply to ``map'' the file into the virtual address space.  The
177 program can then use load and store instructions directly on the file
178 data.  (An alternative way of viewing the file system is as ``durable
179 memory.''  Files just store data structures.  If you access data
180 structures in memory using load and store instructions, why not access
181 data structures in files the same way?)
182
183 Memory mapped files are typically implemented using system calls.  One
184 system call maps the file to a particular part of the address space.
185 For example, one might map the file @file{foo}, which is 1000 bytes
186 long, starting at address 5000.  Assuming that nothing else is already
187 at virtual addresses 5000@dots{}6000, any memory accesses to these
188 locations will access the corresponding bytes of @file{foo}.
189
190 A consequence of memory mapped files is that address spaces are
191 sparsely populated with lots of segments, one for each memory mapped
192 file (plus one each for code, data, and stack).  You will implement
193 memory mapped files for problem 3 of this assignment, but you should
194 design your solutions to problems 1 and 2 to account for this.
195
196 @node Stack
197 @section Stack
198
199 In project 2, the stack was a single page at the top of the user
200 virtual address space.  The stack's location does not change in this
201 project, but your kernel should allocate additional pages to the stack
202 on demand.  That is, if the stack grows past its current bottom, the
203 system should allocate additional pages for the stack as necessary,
204 unless those pages are unavailable because they are in use by another
205 segment, in which case some sort of fault should occur.
206
207 @node Problem 3-1 Page Table Management
208 @section Problem 3-1: Page Table Management
209
210 Implement page directory and page table management to support virtual
211 memory.  You will need data structures to accomplish the following
212 tasks:
213
214 @itemize @bullet
215 @item
216 Some way of translating in software from virtual page frames to
217 physical page frames (consider using a hash table---note
218 that we provide one in @file{lib/kernel}).
219
220 @item
221 Some way of translating from physical page frames back to virtual
222 page frames, so that when you replace a page, you can invalidate
223 its translation(s).
224
225 @item
226 Some way of finding a page on disk if it is not in memory.  You won't
227 need this data structure until part 2, but planning ahead is a good
228 idea.
229 @end itemize
230
231 You need to do the roughly the following to handle a page fault:
232
233 @enumerate 1
234 @item
235 Determine the location of the physical page backing the virtual
236 address that faulted.  It might be in the file system, in swap,
237 already be in physical memory and just not set up in the page table,
238 or it might be an invalid virtual address.
239
240 If the virtual address is invalid, that is, if there's no physical
241 page backing it, or if the virtual address is above @code{PHYS_BASE},
242 meaning that it belongs to the kernel instead of the user, then the
243 process's memory access must be disallowed.  You should terminate the
244 process at this point, being sure to free all of its resources.
245
246 @item
247 If the physical page is not in physical memory, bring it into memory.
248 If necessary to make room, first evict some other page from memory.
249 (When you do that you need to first remove references to the page from
250 any page table that refers to it.)
251
252 @item
253 Each user process's @code{struct thread} has a @samp{pagedir} member
254 that points to its own per-process page directory.  Read the PDE for
255 the faulting virtual address.
256
257 @item 
258 If the PDE is marked ``not present'' then allocate a new page table
259 page and initialize the PDE to point to the new page table.  As when
260 you allocated a data page, you might have to first evict some other
261 page from memory.
262
263 @item
264 Follow the PDE to the page table.  Point the PTE for the faulting
265 virtual address to the physical page found in step 2.
266 @end enumerate
267
268 You'll need to modify the ELF loader in @file{userprog/addrspace.c} to
269 do page table management according to your new design.  As supplied,
270 it reads all the process's pages from disk and initializes the page
271 tables for them at the same time.  For testing purposes, you'll
272 probably want to leave the code that reads the pages from disk, but
273 use your new page table management code to construct the page tables
274 only as page faults occur for them.
275
276 There are many possible ways to implement virtual memory.  The above
277 is simply an outline of our suggested implementation.  You may choose
278 any implementation you like, as long as it accomplishes the goal.
279
280 @node Problem 3-2 Paging To and From Disk
281 @section Problem 3-2: Paging To and From Disk
282
283 Implement paging to and from disk.
284
285 You will need routines to move a page from memory to disk and from
286 disk to memory.  You may use the Pintos file system for swap space, or
287 you may use the disk on interface @code{hd1:1}, which is otherwise
288 unused.  A swap disk can theoretically be faster than using the file
289 system, because it avoid file system overhead and because the swap
290 disk and file system disk will be on separate hard disk controllers.
291 You will definitely need to be able to retrieve pages from files in
292 any case, so to avoid special cases it may be easier to use a file for
293 swap.  You will still be using the basic file system provided with
294 Pintos.  If you do everything correctly, your VM should still work
295 when you implement your own file system for the next assignment.
296
297 You will need a way to track pages which are used by a process but
298 which are not in physical memory, to fully handle page faults.  Pages
299 that you store on disk should not be constrained to be in sequential
300 order, and consequently your swap file (or swap disk) should not
301 require unused empty space.  You will also need a way to track all of
302 the physical memory pages, in order to find an unused one when needed,
303 or to evict a page when memory is needed but no empty pages are
304 available.  The data structures that you designed in part 1 should do
305 most of the work for you.
306
307 You will need a page replacement algorithm.  The hardware sets the
308 accessed and dirty bits when it accesses memory.  Therefore, you
309 should be able to take advantage of this information to implement some
310 algorithm which attempts to achieve LRU-type behavior.  We expect that
311 your algorithm perform at least as well as a reasonable implementation
312 of the second-chance (clock) algorithm.  You will need to show in your
313 test cases the value of your page replacement algorithm by
314 demonstrating for some workload that it pages less frequently using
315 your algorithm than using some inferior page replacement policy.  The
316 canonical example of a poor page replacement policy is random
317 replacement.
318
319 Since you will already be paging from disk, you should implement a
320 ``lazy'' loading scheme for new processes.  When a process is created,
321 it will not run immediately.  Therefore, it doesn't make sense to load
322 all its code, data, and stack into memory when the process is created,
323 since it might incur additional disk accesses to do so (if it gets
324 paged out before it runs).  When loading a new process, you should
325 leave most pages on disk, and bring them in as demanded when the
326 program begins running.  Your VM system should also use the executable
327 file itself as backing store for read-only segments, since these
328 segments won't change.
329
330 There are a few special cases.  Look at the loop in
331 @code{load_segment()} in @file{userprog/addrspace.c}.  Each time
332 around the loop, @code{read_bytes} represents the number of bytes to
333 read from the executable file and @code{zero_bytes} represents the number
334 of bytes to initialize to zero following the bytes read.  The two
335 always sum to @code{PGSIZE}.  The page handling depends on these
336 variables' values:
337
338 @itemize @bullet
339 @item
340 If @code{read_bytes} equals @code{PGSIZE}, the page should be demand
341 paged from disk on its first access.
342
343 @item 
344 If @code{zero_bytes} equals @code{PGSIZE}, the page does not need to
345 be read from disk at all because it is all zeroes.  You should handle
346 such pages by creating a new page consisting of all zeroes at the
347 first page fault.
348
349 @item
350 If neither @code{read_bytes} nor @code{zero_bytes} equals
351 @code{PGSIZE}, then part of the page is to be read from disk and the
352 remainder zeroed.  This is a special case, which you should handle by
353 reading the partial page from disk at executable load time and zeroing
354 the rest of the page.  It is the only case in which loading should not
355 be ``lazy''; even real OSes such as Linux do not load partial pages
356 lazily.
357 @end itemize
358
359 Incidentally, if you have trouble handling the third case above, you
360 can eliminate it temporarily by linking the test programs with a
361 special ``linker script.''  Read @file{tests/userprog/Makefile} for
362 details.  We will not test your submission with this special linker
363 script, so the code you turn in must properly handle all cases.
364
365 You may optionally implement sharing: when multiple processes are
366 created that use the same executable file, share read-only pages among
367 those processes instead of creating separate copies of read-only
368 segments for each process.  If you carefully designed your data
369 structures in part 1, sharing of read-only pages should not make this
370 part significantly harder.
371
372 @node Problem 3-3 Memory Mapped Files
373 @section Problem 3-3: Memory Mapped Files
374
375 Implement memory mapped files.
376
377 You will need to implement the following system calls:
378
379 @table @asis
380 @item SYS_mmap
381 @itemx bool mmap (int @var{fd}, void *@var{addr}, unsigned @var{length})
382
383 Maps the file open as @var{fd} into the process's address space
384 starting at @var{addr} for @var{length} bytes.  Returns true if
385 successful, false on failure.  
386
387 @item SYS_munmap
388 @itemx bool munmap (void *addr, unsigned length)
389
390 Unmaps the segment specified by id.  This cannot be used to unmap
391 segments mapped by the executable loader.  Returns 0 on success, -1 on
392 failure.  When a file is unmapped, all outstanding changes are written
393 to the file, and the segment's pages are removed from the process's
394 list of used virtual pages.
395 @end table
396
397 Calls to @code{mmap} must fail if the address is not page-aligned, if
398 the length is not positive and a multiple of @var{PGSIZE}.  You also
399 must error check to make sure that the new segment does not overlap
400 already existing segments, and fail if it isn't.  If the length passed
401 to @code{mmap} is less than the file's length, you should only map the
402 first part of the file.  If the length passed to @code{mmap} is longer
403 than the file, the file should grow to the requested length.  Similar
404 to the code segment, your VM system should be able to use the
405 @code{mmap}'d file itself as backing store for the mmap segment, since
406 the changes to the @code{mmap} segment will eventually be written to
407 the file.  (In fact, you may choose to implement executable mappings
408 as a special case of file mappings.)
409
410 @node Virtual Memory FAQ
411 @section FAQ
412
413 @enumerate 1
414 @item
415 @b{Do we need a working HW 2 to implement HW 3?}
416
417 Yes.
418
419 @item
420 @b{How do I use the hash table provided in @file{lib/hash.c}?}
421
422 FIXME
423
424 There are two things you need to use this hashtable:
425
426 1. You need to decide on a key type. The key should be something
427 that is unique for each object as inserting two objects with
428 the same key will cause the second to overwrite the first.
429 (The keys are compared with ==, so you should stick to
430 integers and pointers unless you know how to do operator
431 overloading.) You also need to write a hash function that
432 converts key values to integers, which you will pass into the
433 hash table constructor.
434
435 2. Your key needs to be a field of your object type, and you
436 will need to supply a 'get' function that given an object
437 returns the key.
438
439 Here's a quick example of how to construct a hash table. In
440 this table the keys are Thread pointers and the objects are
441 integers (you will be using different key/value pairs I'm
442 sure). In addition, this hash function is pretty puny. You
443 should probably use a better one.
444
445 @example
446 FIXME
447 @end example
448
449 and to construct the hash table:
450
451 HashTable<Thread *, HashObject *> *htable;
452
453 htable = new HashTable<Thread *, HashObject *>(ExtractKeyFromHashObject,
454                                             MyKeyToHashValue);
455
456 If you have any other questions about hash tables, the CS109
457 and CS161 textbooks have good chapters on them, or you can come
458 to any of the TA's office hours for further clarification.
459
460 @item
461 @b{The current implementation of the hash table does not do something
462 that we need it to do. What gives?}
463
464 You are welcome to modify it.  It is not used by any of the code we
465 provided, so modifying it won't affect any code but yours.  Do
466 whatever it takes to make it work like you want it to.
467
468 @item
469 @b{Is the data segment page-aligned?}
470
471 No.
472
473 @item
474 @b{What controls the layout of user programs?}
475
476 The linker is responsible for the layout of a user program in
477 memory. The linker is directed by a ``linker script'' which tells it
478 the names and locations of the various program segments. The
479 test/script and testvm/script files are the linker scripts for the
480 multiprogramming and virtual memory assignments respectively. You can
481 learn more about linker scripts by reading the ``Scripts'' chapter in
482 the linker manual, accessible via @samp{info ld}.
483
484 @item Page Table Management FAQs
485 @enumerate 1
486 @item
487 @b{How do we manage allocation of pages used for page tables?}
488
489 You can use any reasonable algorithm to do so.  However, you should
490 make sure that memory used for page tables doesn't grow so much that
491 it encroaches deeply on the memory used for data pages.
492
493 Here is one reasonable algorithm.  At OS boot time, reserve some fixed
494 number of pages for page tables.  Then, each time a new page table
495 page is needed, select one of these pages in ``round robin'' fashion.
496 If the page in use, clean up any pointers to it.  Then use it for the
497 new page table page.
498
499 @item
500 @b{Our code handles the PageFault exceptions. However, the number of
501 page faults handled does not show up in the final stats output. Is
502 there a counter that we must increment to correct this problem?}
503
504 FIXME 
505
506 Yes, you'll need to update kernel->stats->numPageFaults when
507 you handle a page fault in your code.
508 @end enumerate
509
510 @item Paging FAQs
511
512 @enumerate 1
513 @item
514 @b{Can we assume (and enforce) that the user's stack will
515 never increase beyond one page?}
516
517 No.  This value was useful for project 2, but for this assignment, you
518 need to implement an extensible stack segment.
519
520 @item
521 @b{Does the virtual memory system need to support growth of the data
522 segment?}
523
524 No.  The size of the data segment is determined by the linker.  We
525 still have no dynamic allocation in Pintos (although it is possible to
526 ``fake'' it at the user level by using memory-mapped files).
527 Implementing @code{sbrk()} has been an extra-credit assignment in
528 previous years, but adds little additional complexity to a
529 well-designed system.
530
531 @item
532 @b{Does the virtual memory system need to support growth of the stack
533 segment?}
534
535 Yes. If a page fault appears just below the last stack segment page,
536 you must add a new page to the bottom of the stack. It is impossible
537 to predict how large the stack will grow at compile time, so we must
538 allocate pages as necessary. You should only allocate additional pages
539 if they ``appear'' to be stack accesses.
540
541 @item
542 @b{But what do you mean by ``appear'' to be stack accesses? How big can a
543 stack growth be?  Under what circumstances do we grow the stack?}
544
545 If it looks like a stack request, then you grow the stack. Yes, that's
546 ambiguous. You need to make a reasonable decision about what looks
547 like a stack request. For example, you could decide a page, or two
548 pages, or ten pages, or more@enddots{}  Or, you could use some other
549 heuristic to figure this out.
550
551 Make a reasonable decision and document it in your code and in
552 your design document.  Please make sure to justify your decision.
553
554 @item
555 @b{How big should the file(s) we're using as a backing store for memory
556 be?}
557
558 These files will need to be able to grow based on the number of pages
559 you're committed to storing on behalf of the processes currently in
560 memory.  They should be able to grow to the full size of the disk.
561 @end enumerate
562
563 @item Memory Mapped File FAQs
564
565 @enumerate 1
566 @item
567 @b{How do we interact with memory-mapped files?}
568
569 Let's say you want to map a file called @file{foo} into your address
570 space at address @t{0x10000000}. You open the file, determine its
571 length, and then use Mmap:
572
573 @example
574 #include <stdio.h>
575 #include <syscall.h>
576
577 int main (void)
578 @{
579     void *addr = (void *) 0x10000000;
580     int fd = open ("foo");
581     int length = filesize (fd);
582     if (mmap (fd, addr, length))
583         printf ("success!\n");
584 @}
585 @end example
586
587 Suppose @file{foo} is a text file and you want to print the first 64
588 bytes on the screen (assuming, of course, that the length of the file
589 is at least 64).  Without @code{mmap}, you'd need to allocate a
590 buffer, use @code{read} to get the data from the file into the buffer,
591 and finally use @code{write} to put the buffer out to the display. But
592 with the file mapped into your address space, you can directly address
593 it like so:
594
595 @example
596 write (addr, 64, STDOUT_FILENO);
597 @end example
598
599 Similarly, if you wanted to replace the first byte of the file,
600 all you need to do is:
601
602 @example
603 addr[0] = 'b';
604 @end example
605
606 When you're done using the memory-mapped file, you simply unmap
607 it:
608
609 @example
610 munmap (addr);
611 @end example
612
613 @item
614 @b{What if two processes memory-map the same file?}
615
616 There is no requirement in Pintos that the two processes see
617 consistent data.  Unix handles this by making the processes share the
618 same physical page, but the @code{mmap} system call also has an
619 argument allowing the client to specify whether the page is shared or
620 private (i.e.@: copy-on-write).
621
622 @item
623 @b{What happens if a user removes a @code{mmap}'d file?}
624
625 @item
626 You should follow the Unix convention and the mapping should still be
627 valid.  This is similar to the question in the User Programs FAQ about
628 a process with a file descriptor to a file that has been removed.
629
630 @item
631 @b{What if a process writes to a page that is memory-mapped, but the
632 location written to in the memory-mapped page is past the end
633 of the memory-mapped file?}
634
635 Can't happen.  @code{mmap} extends the file to the requested length,
636 and Pintos provides no way to shorten a file.  You can remove a file,
637 but the mapping remains valid (see the previous question).
638
639 @item
640 @b{Do we have to handle memory mapping @code{stdin} or @code{stdout}?}
641
642 No.  Memory mapping implies that a file has a length and that a user
643 can seek to any location in the file.  Since the console device has
644 neither of these properties, @code{mmap} should return false when the
645 user attempts to memory map a file descriptor for the console device.
646
647 @item
648 @b{What happens when a process exits with mmap'd files?}
649
650 When a process finishes each of its @code{mmap}'d files is implicitly
651 unmapped.  When a process @code{mmap}s a file and then writes into the
652 area for the file it is making the assumption the changes will be
653 written to the file.
654
655 @item
656 @b{If a user closes a mmaped file, should be automatically unmap it
657 for them?}
658
659 No, once created the mapping is valid until @code{munmap} is called
660 or the process exits.
661 @end enumerate
662 @end enumerate