-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME_HW5
57 lines (43 loc) · 3.07 KB
/
README_HW5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
README for HW5
@Author Yakov Gaberman ygaberman
@Author Maedeh Safari msafari
-------------------------------
Overview
-------------------------------
To implement demand paging for the AddressSpace, it was first necessary to initialize the page table entries' valid bit to false.
Also no file pages are read in on the exec call. (We also implemented demand paging for the actual test program's executable).
As the program counter continues, it triggers page faults which is handled in our ExceptionHandler.
The demandMalloc function is called which finds the segment which the BadVAddr belongs to and allocates a page for that segment.
If the page fault occurs on the boundary between the segments, a page with data belonging to both segments with the proper offsets is loaded into memory.
For this assignment any executable loaded into memory will have page table entries initialized to invalid.
Demand paging was extended to the initial executable as well, not just files called by the exec syscall.
-------------------------------
Instructions
-------------------------------
The system is configured to use the Nachos RealFileSystem.
Therefore any programs will need to be run with '-cp <prog name> -x <prog name>' to execute them.
NOTE: You also need to copy over any files that are being used through sycalls such as mmap in the test file. See more information about our test programs below.
-------------------------------
Testing
-------------------------------
Several user programs were created to test for this assignment:
mmap.c: simple program which calls mmap on a file called "test/foobar", which can be created by calling "echo a > foobar.txt" to create a file foobar with a size of one byte.
foobar should be loaded into the DISK0 by calling "-cp test/foobar" first.
This program will allocate memory for that file and then deallocate it with the munmap syscall.
mmap2.c: same as above except this program writes to the memory mapped file,
and then deallocates that memory mapped file with munmap which writes the changes to the file.
mmap3.c: This test file will call mmap 3 times:
1. mmap with test/foobar and fill it 10 times with character 'a'
2. mmap with test/foobar2 and fill it 10 times with character 'b'
3. mmap with test/foobar3 and fill it 10 times with character 'c'
Then it will unmap in the following order: foobar2, foobar, foobar3
mmap4.c: This tests file will call mmap on the same file until there are no more physical pages available.
It will then write back the pages that were modified, and exit the program.
**** NOTE: To see the memory mapped file changes on disk run "od -c DISKO > disk0.txt"
-------------------------------
General Notes For Developers
-------------------------------
- When using the real filesystem, it is necessary to copy over the first executable into the "DISK".
This can be done with the -cp <prog name> flag.
- When first starting the real filesystem it is necessary to use -f to reformat the file system. Later on it can be removed.
- The real file system creates a default directory /test on the disk when first initialized.