diff options
| author | Karoline Knoth <e0326266@student.tuwien.ac.at> | 2012-06-22 01:40:02 +0200 |
|---|---|---|
| committer | Karoline Knoth <e0326266@student.tuwien.ac.at> | 2012-06-22 01:40:02 +0200 |
| commit | 25f8116442c7cdfa206186fa0d23ced5ebda857f (patch) | |
| tree | 95cded740e911b695094bdda975f546fea46d03a | |
| parent | 2f00636b80c713be718a7656ce82947fb8f3ecf1 (diff) | |
| download | progos-25f8116442c7cdfa206186fa0d23ced5ebda857f.tar.gz progos-25f8116442c7cdfa206186fa0d23ced5ebda857f.tar.bz2 progos-25f8116442c7cdfa206186fa0d23ced5ebda857f.zip | |
additions to proj2 documentation about synchronization
| -rw-r--r-- | proj2.txt | 32 |
1 files changed, 15 insertions, 17 deletions
| @@ -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 | ||
| 62 | As we do not have any global structures, that means they are per process and | 62 | All system calls assert that a page fault can never occur while the |
| 63 | per thread, page faults can not happen. The same argument goes for the | 63 | file system is locked. As for this reason syscall_read uses a temporary page |
| 64 | question of being deadlock free. | 64 | as buffer which is copied into user space after the filesystem is unlocked |
| 65 | again. This means if a page fault occurs during copying the file system is not | ||
| 66 | locked 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 | ||
| 82 | The stack growth itself gets triggered by the page fault handler just as the | 84 | The stack growth itself is triggered by the page fault handler just as the |
| 83 | lazy loading of pages. Other than that there's no association between the pages | 85 | lazy loading of pages. Other than that there's no association between the pages |
| 84 | of the stack and the pages of segments/mmapped files. | 86 | of the stack and the pages of segments/mmapped files. |
| 85 | So pages of the stack don't get tracked inside the page table at all! | 87 | So 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 | ||
| 118 | struct 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 | ||
| 126 | For every memory mapped file we create a new per process mmap table. Its entries contain | 125 | For every page required by the memory mapped file we create an associated entry |
| 127 | the virtual address of the first memory mapped file, the file handler and the number | 126 | in the page table. It contains the first virtual address of the memory mapped file, |
| 128 | of pages which are needed for the mapping. Additionally we store the lowest | 127 | the file handler and the number of pages which are needed for the mapping. |
| 129 | free index, the highest used index and the capacity of the mmap table. We then | 128 | Additionally we store the lowest free index, the highest used index and the |
| 130 | create for ever page required by the memory mapped file a new page table | 129 | capacity of the mmap table. We then create for every page required by the |
| 131 | entry. | 130 | memory 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 | ||
| 136 | We avoid overlaps of file mappings by determining in the systemcall which tries | 135 | We avoid overlaps of file mappings by determining in the systemcall which tries |
| 137 | to map a file if the required number of pages for the mapping are still free. | 136 | to map a file if the required number of pages for the mapping are still free. |
| 138 | To obtain this information we lookup if there are entries in the page table | 137 | To obtain this information we lookup the entries in the page table |
| 139 | that imply that the memory space needed for the mapping is occupied by other | 138 | that imply that the memory space needed for the mapping is occupied by other |
| 140 | pages. Furthermore we must check if any page not in the page table (for | 139 | pages. Furthermore we must check if any page not in the page table (for |
| 141 | instance loaded pages on the stack) occupies the space we want to map our file | 140 | instance 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 | ||
| 153 | As our implementation of the supplemental page table does not distinguish | 152 | As our implementation of the supplemental page table does not distinguish |
| 154 | pages that came from memory mapped files and pages from executables, both the | 153 | between pages of memory mapped files and pages of data segments they share |
| 155 | supplemental page table as the memory mapped file table can share the page | 154 | the same insert and loading code. |
| 156 | table routines. | ||
| 157 | 155 | ||
| 158 | SURVEY QUESTIONS | 156 | SURVEY QUESTIONS |
| 159 | ================ | 157 | ================ |
