There are 4 parts to this homework. You may either i) type up the answers and submit on Blackboard as a .txt or .pdf file; or ii) hand-write them and submit on Blackboard a clear image of them (.jpg or .pdf).
a) Assume you are on a Unix terminal set up like the one at http://www.tutorialspoint.com/unix_terminal_online.php. That is, you are in the directory /home/cg/root/ which contains exactly one file, README.txt. Give the commands you execute at the command line prompt to get the following directory and file structure:
- the root directory contains exactly two directories called dir1 and dir2, and no files
- the directory dir1 contains the file README.txt
- the directory dir2 contains the file README.txt
b) Assume you are on a Unix terminal set up like the one at http://www.tutorialspoint.com/unix_terminal_online.php. That is, you are in the directory /home/cg/root/ which contains exactly one file, README.txt. Describe or draw a picture of the file and directory structure after executing the following commands:
>mv README.txt hello.txt
>mkdir subroot
>cd subroot
>mkdir flower
>cp ../hello.txt . <-- this line has been changed. Old line: >cp ../../hello.txt .
c) Assume you are on a Unix terminal set up like the one at http://www.tutorialspoint.com/unix_terminal_online.php. That is, you are in the directory /home/cg/root/ which contains exactly one file, README.txt. Give the commands you execute at the command line prompt to get the following directory and file structure:
- the root directory contains a single directory called country and no files
- the directory country contains two directories called USA and Canada, and the file README.txt
- the directory USA contains a single directory called New York
- the directory New York contain the file README.txt
d) Assume you are on a Unix terminal set up like the one at http://www.tutorialspoint.com/unix_terminal_online.php. That is, you are in the directory /home/cg/root/ which contains exactly one file, README.txt. Describe or draw a picture of the file and directory structure after executing the following commands:
>mkdir one
>mkdir two
>mkdir two/three
>mkdir four
>cd two
>touch turtle.txt
>cp turtle.txt ../one
>cd ..
>cp README.txt four
CMP 426 students should do parts (a) - (d), and may do part (e) for extra credit. CMP 697 students should do parts (a) - (e). You may either i) type up the answers and submit on Blackboard as a .txt or .pdf file; or ii) hand-write them and submit on Blackboard a clear image of them (.jpg or .pdf).
For each part, you will be given a scheduler and a list of jobs, with their arrival time and length. You should:
a) Scheduler: First-in-first-out (FIFO)
Job | Arrival Time | Run Time |
---|---|---|
A | 0 ms | 20 ms |
B | 10 ms | 50 ms |
C | 30 ms | 10 ms |
b) Scheduler: Shortest Job First (SJF)
Job | Arrival Time | Run Time |
---|---|---|
A | 0 ms | 20 ms |
B | 0 ms | 30 ms |
C | 10 ms | 10 ms |
D | 30 ms | 40 ms |
c) Scheduler: Shortest Time to Completion First (STCF)
Job | Arrival Time | Run Time |
---|---|---|
A | 0 ms | 30 ms |
B | 0 ms | 10 ms |
C | 0 ms | 40 ms |
D | 20 ms | 20 ms |
d) Scheduler: Round Robin (RR) which uses 10ms time slices
Job | Arrival Time | Run Time |
---|---|---|
A | 0 ms | 30 ms |
B | 10 ms | 40 ms |
C | 20 ms | 10 ms |
e) (for CMP 697, but CMP 426 students may do for extra credit)
Scheduler: Multi-Level Feedback Queue (MLFQ) which uses 10ms time slices and 3 queues.
Jobs are boosted back to highest priority every 30ms.
Job | Arrival Time | Run Time |
---|---|---|
A | 0 ms | 50 ms |
B | 10 ms | 10 ms |
C | 20 ms | 50 ms |
For full and partial credit, show your work. You may either i) type up the answers and submit on Blackboard as a .txt or .pdf file; or ii) hand-write them and submit on Blackboard a clear image of them (.jpg or .pdf).
1) Assume a computer uses segmentation only (and not paging) to manage memory. Each segment has its own base, bounds, and protection bits, as given below:
Segment | Base | Bounds | R W |
---|---|---|---|
0 | 0x5000 | 0x0ff | 1 0 |
1 | 0x1000 | 0x7ff | 1 1 |
2 | 0x3000 | 0xfff | 1 1 |
3 | 0x0000 | 0x000 | 0 0 |
For the following logical addresses (in hex), either translate them into a physical address or write if they would give an error. Assume each address is 14 bits, with 2 bits for the segment.
i) read 0x0045
ii) write 0x26ac
iii) read 0x1a55
iv) write 0x0010
2) Given a page size of 8KB, a virtual address size of 32 bits, and a page table entry size of 4 bytes:
i) how many bits are needed for the offset?
ii) how many bits are available for the virtual page number?
iii) how many pages are possible?
iv) how large is the page table? That is, how much space does the page table take up in memory?
For full and partial credit, show your work. You may either i) type up the answers and submit on Blackboard as a .txt or .pdf file; or ii) hand-write them and submit on Blackboard a clear image of them (.jpg or .pdf).
1) Assume that the OS is using a combination of segmentation and pages to assign virtual memory to physical memory. Specifically, each segment will have its own page table as in the slides from Day 7 (Thurs. Sept. 13) and textbook Chapter 20. Assume the virtual (or physical) address consists of 32 bits, divided up as follows:
segment # 4 bits |
page # 12 bits |
offset 16 bits |
segment | base | bounds | R W |
---|---|---|---|
0 | 0x00a30000 | 0x0ff | 1 0 |
1 | 0x01000000 | 0xfff | 1 1 |
2 | 0x00050000 | 0x7ff | 1 1 |
The page tables are:
Page table at address 0x00050000 | Entries |
---|---|
0x338 | |
0x1bd | |
0x070 | |
0x02e | |
... |
Page table at address 0x00a30000 | Entries |
---|---|
0x005 | |
0x0a7 | |
0x062 | |
0x04b | |
... |
Page table at address 0x01000000 | Entries |
---|---|
0xdc8 | |
0x030 | |
0x39a | |
0x4d1 | |
... |
For the following logical addresses (in hex), either translate them into a physical address or write if they would give an error.
i) read 0x00002834 <- corrected from 0x0002834 (added 0 at beginning)
ii) write 0x10010010
iii) read 0x20030000
iv) write 0x20018b30
2) Assume that the OS is using 2-level paging to assign virtual memory to physical memory. Specifically, there is an outer page table (or page directory) and an inner page table, as in the slides from Day 7 (Thurs. Sept. 13) and textbook Chapter 20. Assume the virtual (or physical) address consists of 16 bits, divided up as follows:
outer page # 4 bits |
inner page # 4 bits |
offset 8 bits |
Page directory | Entries |
---|---|
0x7 | |
0xb1 | |
0xff | |
0x30 | |
... |
Page table at 0xb1 | Entries |
---|---|
0x47 | |
0x6c | |
0x8f | |
0x22 | |
... |
Page table at 0xff | Entries |
---|---|
0xd5 | |
0xf0 | |
0x73 | |
0xaa | |
... |
For the following logical addresses (in hex), either translate them into a physical address.
i) 0x12ee
ii) 0x221a
iii) 0x209e
iv) 0x1333