Difference between revisions of "Operating Systems 2018F: Assignment 4"

From Soma-notes
Jump to navigation Jump to search
Line 1: Line 1:
'''This assignment is not yet finalized.'''
Please submit the answers to the following questions via CULearn by 2:30 PM on Wednesday, November 21, 2018. There are 20 points in 11 questions (and one bonus question worth 5 points).
Please submit the answers to the following questions via CULearn by 2:30 PM on Wednesday, November 21, 2018. There are 20 points in 11 questions (and one bonus question worth 5 points).



Revision as of 21:57, 12 November 2018

Please submit the answers to the following questions via CULearn by 2:30 PM on Wednesday, November 21, 2018. There are 20 points in 11 questions (and one bonus question worth 5 points).

Submit your answers as a single text file named "<username>-comp3000-assign4.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 4", your name, student number, and the date of submission. You may wish to format your answers in Markdown to improve their appearance.

No other formats will be accepted. Submitting in another format will likely result in your assignment not being graded and you receiving no marks for this assignment. In particular do not submit an MS Word or OpenOffice file as your answers document!

Don't forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resources. You do not need to list help from the instructor, TA, or information found in the textbook.

Questions

  1. [1] Does alloc_pages() in the Linux kernel immediately allocate memory, or is memory allocated when it is accessed?
  2. [1] Does an anonymous mmap system call allocate memory immediately, or is the memory allocated as it is accessed?
  3. [2] What is one key advantage of lazy memory allocation? What is one key disadvantage?
  4. [2] Assume we have modified the remember module so it allocates 16K (4 pages) at a time, and assume we have stored in /dev/remember 16K copies of the letter "a".
    • As written, what will a read of /dev/remember return if we use a 4K buffer, starting at the beginning of the file?
    • What will happen if we do a second read, again with a 4K buffer (on the same open file)?
  5. [2] When is memory dynamically allocated in the remember module? When is it freed?
  6. [2] As written, what happens when multiple write calls are made to /dev/remember? What is remembered? Why?
  7. [2] What system call causes getattr() in memoryll.py to be called (on files in a memoryll filesystem)? How did you verify this?
  8. [2] What function in memoryll would you have to change to make it impossible to change file timestamps? Why?
  9. [2] When you run fusermount via execve, what euid does fusermount's process have? What uid does it have?
  10. [2] What is a process's effective uid (euid)? Why is the euid not always equal to its uid?
  11. [2] What system calls does memoryll make when performing file operations on behalf of the kernel? Give one concrete example showing how things work. (Hint: you won't be able to strace memoryll as a regular user.)
  12. [BONUS 5] Implement mmap for the remember device. Show your implementation and explain how it works.