Operating Systems 2019W: Assignment 3

From Soma-notes
Revision as of 14:48, 12 March 2019 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 Sunday, March 24, 2019. There are 20 points in 10 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.

Please make your best effort to do a proper implementation where required. There will be times where you are tempted to copy large portions of code from other parts of the kernel. While you may have to copy a small number of lines, avoid duplicating functionality.

When an answer asks for modifications to the remember module, please give your code as a "diff -c" versus the original remember.c or versus the code for a previous answer.

Questions

  1. [2] What are two reasons Linux kernel code doesn't make system calls?
  2. [2] What code could we use to get the information returned by getuid and geteuid system calls in the kernel? How do you know your code is correct?
  3. [2] When you unload a kernel module, can the kernel automatically deallocate the resources that were used by the module? Explain.
  4. [2] How could a userspace program prevent the remember module from being unloaded? Give code and explain why this code blocks the removal of the remember module.
  5. [2] What happens if you call class_create() in a module using a class name that already exists in the kernel? Describe the process by which you figured out your answer.
  6. [2] Modify the remember module so it allocates memory when the remember module is loaded and frees it when the remember module is unloaded. Be sure to allocate your memory dynamically (i.e., don't statically define a global buffer). This modified version should allocate 16K of storage.
  7. [2] Fix the remember module so that it returns EFAULT to userspace when given an invalid pointer. Describe the process by which you figured out your answer.
  8. [2] In the remember module, modify remember_read() so it uses a non-zero offset properly rather than simply logging an error. Describe the process by which you figured out your answer.
  9. [2] Modify the remember module so llseek system calls work as they do on regular files. Describe the process by which you figured out your answer.