From f1290136ce837893e8b93fc47610079d3029b93d Mon Sep 17 00:00:00 2001 From: Karoline Knoth Date: Thu, 21 Jun 2012 21:05:34 +0200 Subject: answers to the memory mapped files section of the proj2 design document --- proj2.txt | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/proj2.txt b/proj2.txt index 8572b3f..8bbd521 100644 --- a/proj2.txt +++ b/proj2.txt @@ -92,7 +92,7 @@ So pages of the stack don't get tracked inside the page table at all! If we do not find a valid entry in our supplemental page-table it could be very well be a valid stack access. The maximum offset we consider a valid access is caused by the PUSHA instruction, which may try to access an address -32 bytes below the current stack pointer. Everthing higher we consider +32 bytes below the current stack pointer. Everything higher we consider an exception. MEMORY MAPPED FILES @@ -123,16 +123,23 @@ struct page_table_entry: >> C2: Describe how memory mapped files integrate into your virtual >> memory subsystem. -for every page required by the memory mapped file we create a new page table -entry -TODO +For every memory mapped file we create a new per process mmap table. Its entries contain +the virtual address of the first memory mapped file, the file handler and the number +of pages which are needed for the mapping. Additionally we store the lowest +free index, the highest used index and the capacity of the mmap table. We then +create for ever page required by the memory mapped file a new page table +entry. >> C3: Explain how you determine whether a new file mapping overlaps >> any existing segment. -in mmap() we simply check if the required pages are still free (no entry in -the page table). -TODO +We avoid overlaps of file mappings by determining in the systemcall which tries +to map a file if the required number of pages for the mapping are still free. +To obtain this information we lookup if there are entries in the page table +that imply that the memory space needed for the mapping is occupied by other +pages. Furthermore we must check if any page not in the page table (for +instance loaded pages on the stack) occupies the space we want to map our file +to. ---- RATIONALE ---- @@ -143,8 +150,10 @@ TODO >> implementation either does or does not share much of the code for >> the two situations. -we share the same page table entries -TODO +As our implementation of the supplemental page table does not distinguish +pages that came from memory mapped files and pages from executables, both the +supplemental page table as the memory mapped file table can share the page +table routines. SURVEY QUESTIONS ================ -- cgit v1.2.3