Operating Systems 2017F: Assignment 3

From Soma-notes
Revision as of 20:02, 15 November 2017 by Soma (talk | contribs) (→‎Questions)

This assignment is not yet finalized.

Please submit the answers to the following questions via CULearn by 11:55 PM on Thursday, November 20, 2017. There are 20 points in 11 questions.

Submit your answers as a single text file named "<username>-comp3000-assign3.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 3", 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] If you erase the first few blocks of a filesystem, it will become unmountable; however, fsck will generally be able to recover the filesystem. What extra information stored in the filesystem allows fsck to do the repair?
  2. [1] Sometimes the kernel will refuse to unmount a filesystem (when the requesting user has sufficient privileges). What is one important reason why this happens?
  3. [2] Why can't you use printf() in Linux kernel modules, but you can use similar C library functions such as snprintf()? More generally, why is only some some of the standard C library available to kernel code?
  4. [2] What is a process's effective uid (euid)? Why is the euid not always equal to its uid?
  5. [2] When you load a kernel module, are you creating a new process? Why or why not?
  6. [2] Is a running Linux system that is generating multiple "Oops" messages at risk of doing something bad, like corrupting data or crashing? Explain.
  7. [2] Why does newgetpid.c use put_user() in newgetpid_read(), rather than just writing directly to buf? Explain briefly.
  8. [2] How can the logical size of a filesystem be larger than the physical size? How can the logical size be smaller than the physical size?
  9. [2] What type is "current" normally in Linux source code? What does "current" refer to?
  10. [2] What line(s) in newgetpid.c sets the name of the device file (i.e. making it /dev/newgetpid rather than /dev/ones)? How did you verify that your answer was correct?
  11. [2] What changes need to be made to newgetpid.c to allow it to respond to write requests? Hint: How does newgetpid.c respond to read requests?