diff options
Diffstat (limited to 'proj2.txt')
| -rw-r--r-- | proj2.txt | 44 |
1 files changed, 20 insertions, 24 deletions
| @@ -30,13 +30,12 @@ Manuel Mausz <manuel-uni@mausz.at> | |||
| 30 | >> enumeration. Identify the purpose of each in 25 words or less. | 30 | >> enumeration. Identify the purpose of each in 25 words or less. |
| 31 | 31 | ||
| 32 | struct thread: | 32 | struct thread: |
| 33 | struct hash page_table ...supplemental page table of thread | 33 | struct hash page_table ...supplemental page table of thread |
| 34 | 34 | ||
| 35 | struct page_table_entry: | 35 | struct page_table_entry: |
| 36 | void *upage ...virtual address of page | 36 | void *upage ...virtual address of page |
| 37 | bool loaded ...indicates if page is loaded | 37 | bool loaded ...indicates if page is loaded |
| 38 | enum type ...type of page | 38 | struct segment ...structure needed for lazy loading of data segments |
| 39 | union struct segment ...structure needed for lazy loading of data segments | ||
| 40 | struct hash_elem elem ...Hash element. | 39 | struct hash_elem elem ...Hash element. |
| 41 | 40 | ||
| 42 | ---- IMPLEMENTATION ---- | 41 | ---- IMPLEMENTATION ---- |
| @@ -44,28 +43,25 @@ struct page_table_entry: | |||
| 44 | >> determine the file and file offset corresponding to a virtual | 43 | >> determine the file and file offset corresponding to a virtual |
| 45 | >> address? | 44 | >> address? |
| 46 | 45 | ||
| 47 | When we try to insert a new segment into our supplemental page table we record some information in the struct segment of each page table entry. This struct contains | 46 | When we try to insert a new segment into our supplemental page table we record |
| 48 | 47 | some information in the struct segment of each page table entry. | |
| 49 | -) the virtual address of the page | 48 | This struct contains: |
| 50 | -) the type of the page table entry, weather it is an ordinary segment or a | 49 | * the virtual address of the page |
| 51 | memory mapped file page | 50 | * if the page is already loaded or not |
| 52 | -) if the page is already loaded or not (per default false) | 51 | * the associated file |
| 53 | -) the file the page corresponds to | 52 | * the offset in the file |
| 54 | -) the offset in the file | 53 | * if the page is writable or not |
| 55 | -) if the page is writable or not | ||
| 56 | 54 | ||
| 57 | Lazy loading of pages is accomplished by not loading the page instantly. The | 55 | Lazy loading of pages is accomplished by not loading the page instantly. The |
| 58 | actual page-loading is done when a page-fault occurs. | 56 | actual page-loading is done when a page-fault occurs. |
| 59 | 57 | ||
| 60 | |||
| 61 | ---- SYNCHRONIZATION ---- | 58 | ---- SYNCHRONIZATION ---- |
| 62 | >> 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 |
| 63 | >> routines. Argue why your solution is deadlock free. | 60 | >> routines. Argue why your solution is deadlock free. |
| 64 | 61 | ||
| 65 | As we do not have any global structures, that means they are per process and | 62 | As we do not have any global structures, that means they are per process and |
| 66 | per thread, page faults can not happen, the same argument goes for the | 63 | per thread, page faults can not happen. The same argument goes for the |
| 67 | question of being deadlock free. File-structures are per process too, so only | 64 | question of being deadlock free. |
| 68 | one process can deal with a file at once. | ||
| 69 | 65 | ||
| 70 | STACK GROWTH | 66 | STACK GROWTH |
| 71 | ============ | 67 | ============ |
| @@ -83,9 +79,10 @@ extern void *syscall_sp ...stored stack pointer for the "page fault inside | |||
| 83 | >> B2: Describe how you integrated the (potentially growing) stack segment | 79 | >> B2: Describe how you integrated the (potentially growing) stack segment |
| 84 | >> into your page table management implementation. | 80 | >> into your page table management implementation. |
| 85 | 81 | ||
| 86 | The Stack growth itself is implemented in the page fault handler. The page | 82 | The stack growth itself gets triggered by the page fault handler just as the |
| 87 | table is just needed to allocate a new page for the stack when it needs to | 83 | lazy loading of pages. Other than that there's no association between the pages |
| 88 | grow. | 84 | 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! | ||
| 89 | 86 | ||
| 90 | ---- ALGORITHMS ---- | 87 | ---- ALGORITHMS ---- |
| 91 | >> B3: Explain how you detect a page fault which should trigger a | 88 | >> B3: Explain how you detect a page fault which should trigger a |
| @@ -93,11 +90,10 @@ grow. | |||
| 93 | >> to work? | 90 | >> to work? |
| 94 | 91 | ||
| 95 | If we do not find a valid entry in our supplemental page-table it could be | 92 | If we do not find a valid entry in our supplemental page-table it could be |
| 96 | very well be a valid stack access. The maximum offset we consider as a valid | 93 | very well be a valid stack access. The maximum offset we consider a valid |
| 97 | access is due to the PUSHA instruction, which can try to access an address 32 | 94 | access is caused by the PUSHA instruction, which may try to access an address |
| 98 | bytes below the current stack pointer. If this is the case we try to grow the | 95 | 32 bytes below the current stack pointer. Everthing higher we consider |
| 99 | stack by one page. | 96 | an exception. |
| 100 | |||
| 101 | 97 | ||
| 102 | MEMORY MAPPED FILES | 98 | MEMORY MAPPED FILES |
| 103 | =================== | 99 | =================== |
