Difference between revisions of "Operating Systems 2019W: Assignment 3"

From Soma-notes
Jump to navigation Jump to search
Line 27: Line 27:
# [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.
# [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.
# [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.
# [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.
# [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.
# [2] Modify the remember module so llseek system calls work as they do on regular files, for whence values of SEEK_CUR and SEEK_SET.  You should not allow the offset to be set to a value past the current end of file.  Describe the process by which you figured out your answer.
# [4] Modify the remember module so the behavior of writes change as follows:
# [4] Modify the remember module so the behavior of writes change as follows:
#* [1] Increase the allocation size to 16K of storage.
#* [1] Increase the allocation size to 16K of storage.

Revision as of 21:08, 17 March 2019

This assignment is not yet finalized but it is feature complete. Feel free to start working on it, but please check it again after it has been finalized for small changes.

Please submit the answers to the following questions via CULearn by 11:55 PM on Sunday, March 24, 2019. There are 20 points in 9 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 may be 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 significant 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. Points may be deducted for code in improper form. (Note that by using diff -c it is easily possible to automatically apply your changes to the original code in order to get a full working version.)

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] If you remove the remember module while a process is accessing it, what happens to the process? Please give your test program and appropriate output from ps. What happens if you try to reload 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] 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.
  7. [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.
  8. [2] Modify the remember module so llseek system calls work as they do on regular files, for whence values of SEEK_CUR and SEEK_SET. You should not allow the offset to be set to a value past the current end of file. Describe the process by which you figured out your answer.
  9. [4] Modify the remember module so the behavior of writes change as follows:
    • [1] Increase the allocation size to 16K of storage.
    • [1] Allocate memory when data is first written to /dev/remember and free memory when zero bytes are written to /dev/remember or when the remember module is unloaded.
    • [1] Preserve data across writes such that a shorter write preserves data from a previous longer write.
    • [1] Allow writes to non-zero offsets (subject to the maximum size of /dev/remember).