Difference between revisions of "Operating Systems 2014F: Assignment 8"

From Soma-notes
Jump to navigation Jump to search
Line 23: Line 23:
# Any system call that makes use of a pathname (whether it be a file or a directory) in the Memory filesystem causes the lookup method to be invoked.  Thus the open system call causes a lookup method, but also system calls such as mkdir and stat do as well.  (To get full credit you only needed to name one system call.)
# Any system call that makes use of a pathname (whether it be a file or a directory) in the Memory filesystem causes the lookup method to be invoked.  Thus the open system call causes a lookup method, but also system calls such as mkdir and stat do as well.  (To get full credit you only needed to name one system call.)
# Memory's filesystem should only run out of space when the Python process implementing it runs out of space.  Thus, the filesystem can grow to the maximum size of a process.  This maximum will in practice be determined by how much RAM and swap space a computer has, e.g., if a computer has 4 GB of RAM and 4 GB of swap, the filesystem won't be more than 8 GB (and will likely be a good bit less).
# Memory's filesystem should only run out of space when the Python process implementing it runs out of space.  Thus, the filesystem can grow to the maximum size of a process.  This maximum will in practice be determined by how much RAM and swap space a computer has, e.g., if a computer has 4 GB of RAM and 4 GB of swap, the filesystem won't be more than 8 GB (and will likely be a good bit less).
# The files created in the memory filesystem are owned by the user who started the fuse script and can only be accessed by that user.  Even root is excluded.  If root starts the script, then root owns and has exclusive access to those files.  While it is possible to make FUSE-mounted filesystems accessible to other users this is not the default.
#  
#  
#
#
#
#
#
#
#

Revision as of 15:38, 2 December 2014

Please submit the answers to the following questions via CULearn by just before midnight (11:55 PM) on Thursday, November 27, 2014. There 20 points in 8 questions.

Submit your answers as a single text file named "<username>-comp3000-assign8.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 8", 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 a zip file, 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.

Note the following questions make reference to the code from Tutorial 8, specifically memoryll.pl.

  1. [1] How does FUSE bring microkernel-like concepts into the Linux kernel?
  2. [1] What is a system call that generates a call to Memory's lookup method?
  3. [1] What are the storage limits on Memory's filesystem? Specifically, under what circumstances do you expect it to run out of storage space?
  4. [2] What is the connection between the buffer given to the read system call and buf in Memory's read method? Specifically, how does data move between them?
  5. [3] Who owns the files created in Memory's filesystem? How is this determined? Is this connected to whether the filesystem was run as root?
  6. [4] What do attr, data, parent, and children store (as properties of a Memory object)? Explain what is stored and how it is organized at a high level and using what kind of Python data structures.
  7. [4] What are self, req, inode, and fi used to store when used as arguments to methods of Memory?
  8. [4] Modify Memory so it has a top-level file called "log" that records all of the file operations that are normally printed in the terminal window (all the print commands). Be sure to make it so that operations on log are not logged!

Solutions

  1. Microkernels are based on the principle that as much of an operating system's functionality as possible should be in userspace (processes) rather than implemented in the kernel (running in supervisor mode on the CPU). Standard Linux filesystems are implemented inside of the kernel, typically as loadable modules. FUSE allows filesystems to be implemented in userspace.
  2. Any system call that makes use of a pathname (whether it be a file or a directory) in the Memory filesystem causes the lookup method to be invoked. Thus the open system call causes a lookup method, but also system calls such as mkdir and stat do as well. (To get full credit you only needed to name one system call.)
  3. Memory's filesystem should only run out of space when the Python process implementing it runs out of space. Thus, the filesystem can grow to the maximum size of a process. This maximum will in practice be determined by how much RAM and swap space a computer has, e.g., if a computer has 4 GB of RAM and 4 GB of swap, the filesystem won't be more than 8 GB (and will likely be a good bit less).
  4. The files created in the memory filesystem are owned by the user who started the fuse script and can only be accessed by that user. Even root is excluded. If root starts the script, then root owns and has exclusive access to those files. While it is possible to make FUSE-mounted filesystems accessible to other users this is not the default.