summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroline Knoth <e0326266@student.tuwien.ac.at>2012-06-22 01:40:02 +0200
committerKaroline Knoth <e0326266@student.tuwien.ac.at>2012-06-22 01:40:02 +0200
commit25f8116442c7cdfa206186fa0d23ced5ebda857f (patch)
tree95cded740e911b695094bdda975f546fea46d03a
parent2f00636b80c713be718a7656ce82947fb8f3ecf1 (diff)
downloadprogos-25f8116442c7cdfa206186fa0d23ced5ebda857f.tar.gz
progos-25f8116442c7cdfa206186fa0d23ced5ebda857f.tar.bz2
progos-25f8116442c7cdfa206186fa0d23ced5ebda857f.zip
additions to proj2 documentation about synchronization
-rw-r--r--proj2.txt32
1 files changed, 15 insertions, 17 deletions
diff --git a/proj2.txt b/proj2.txt
index 8bbd521..ab96337 100644
--- a/proj2.txt
+++ b/proj2.txt
@@ -59,9 +59,11 @@ actual page-loading is done when a page-fault occurs.
59>> A3: How do you deal with or prevent page faults in file system 59>> A3: How do you deal with or prevent page faults in file system
60>> routines. Argue why your solution is deadlock free. 60>> routines. Argue why your solution is deadlock free.
61 61
62As we do not have any global structures, that means they are per process and 62All system calls assert that a page fault can never occur while the
63per thread, page faults can not happen. The same argument goes for the 63file system is locked. As for this reason syscall_read uses a temporary page
64question of being deadlock free. 64as buffer which is copied into user space after the filesystem is unlocked
65again. This means if a page fault occurs during copying the file system is not
66locked an therefore this cannot create a deadlock.
65 67
66 STACK GROWTH 68 STACK GROWTH
67 ============ 69 ============
@@ -79,7 +81,7 @@ extern void *syscall_sp ...stored stack pointer for the "page fault inside
79>> B2: Describe how you integrated the (potentially growing) stack segment 81>> B2: Describe how you integrated the (potentially growing) stack segment
80>> into your page table management implementation. 82>> into your page table management implementation.
81 83
82The stack growth itself gets triggered by the page fault handler just as the 84The stack growth itself is triggered by the page fault handler just as the
83lazy loading of pages. Other than that there's no association between the pages 85lazy loading of pages. Other than that there's no association between the pages
84of the stack and the pages of segments/mmapped files. 86of the stack and the pages of segments/mmapped files.
85So pages of the stack don't get tracked inside the page table at all! 87So pages of the stack don't get tracked inside the page table at all!
@@ -115,27 +117,24 @@ struct mmap_table_entry:
115 struct file *file; ...file handle 117 struct file *file; ...file handle
116 int pages; ...number of pages the mapping needs 118 int pages; ...number of pages the mapping needs
117 119
118struct page_table_entry:
119 union struct TODO ...structure needed for loading of memory mapped files
120
121---- ALGORITHMS ---- 120---- ALGORITHMS ----
122 121
123>> C2: Describe how memory mapped files integrate into your virtual 122>> C2: Describe how memory mapped files integrate into your virtual
124>> memory subsystem. 123>> memory subsystem.
125 124
126For every memory mapped file we create a new per process mmap table. Its entries contain 125For every page required by the memory mapped file we create an associated entry
127the virtual address of the first memory mapped file, the file handler and the number 126in the page table. It contains the first virtual address of the memory mapped file,
128of pages which are needed for the mapping. Additionally we store the lowest 127the file handler and the number of pages which are needed for the mapping.
129free index, the highest used index and the capacity of the mmap table. We then 128Additionally we store the lowest free index, the highest used index and the
130create for ever page required by the memory mapped file a new page table 129capacity of the mmap table. We then create for every page required by the
131entry. 130memory mapped file a new page table entry.
132 131
133>> C3: Explain how you determine whether a new file mapping overlaps 132>> C3: Explain how you determine whether a new file mapping overlaps
134>> any existing segment. 133>> any existing segment.
135 134
136We avoid overlaps of file mappings by determining in the systemcall which tries 135We avoid overlaps of file mappings by determining in the systemcall which tries
137to map a file if the required number of pages for the mapping are still free. 136to map a file if the required number of pages for the mapping are still free.
138To obtain this information we lookup if there are entries in the page table 137To obtain this information we lookup the entries in the page table
139that imply that the memory space needed for the mapping is occupied by other 138that imply that the memory space needed for the mapping is occupied by other
140pages. Furthermore we must check if any page not in the page table (for 139pages. Furthermore we must check if any page not in the page table (for
141instance loaded pages on the stack) occupies the space we want to map our file 140instance loaded pages on the stack) occupies the space we want to map our file
@@ -151,9 +150,8 @@ to.
151>> the two situations. 150>> the two situations.
152 151
153As our implementation of the supplemental page table does not distinguish 152As our implementation of the supplemental page table does not distinguish
154pages that came from memory mapped files and pages from executables, both the 153between pages of memory mapped files and pages of data segments they share
155supplemental page table as the memory mapped file table can share the page 154the same insert and loading code.
156table routines.
157 155
158 SURVEY QUESTIONS 156 SURVEY QUESTIONS
159 ================ 157 ================