Assignment 4: Chapter 2 and 3

This assignment is to be completed individually, not as a group.

Please make sure that you're using the same edition of the book. There is no guarantee that older editions use the same numbering for problems. Please submit a single tar file.

  1. Operating Systems Concepts, 2.3
  2. 2.5: What are the five major activities of an operating system in regard to file management?
  3. 2.8: What are the two models of interprocess communication? What are the strengths and weaknesses of the two approaches?
  4. 2.12: What is the main advantage of the microkernel approach to system design? How do user programs and system services interact in a microker- nel architecture? What are the disadvantages of using the microkernel approach?
  5. 2.14: What is the main advantage for an operating-system designer of using a virtual-machine architecture? What is the main advantage for a user?
  6. 2.18 (varied): In Section 2.3, the textbook described a program that copies the contents of one file to a destination file. This program works by first prompting the user for the name of the source and destination files. Write a similar C program using the POSIX API, except that it obtains the file names from the command line: filecopy source destination.

    Be sure to include all necessary error checking, including ensuring that the source file exists. Also be sure to close the input and output files when the program completes. Once you have correctly designed and tested the program, run the program using a utility that traces system calls. For example, Linux systems provide the strace utility for tracing system calls. If the executable file is called filecopy, the strace command is invoked as follows:

    strace ./filecopy 

    Next, answer the following questions (this will require carefully examining the output of system calls):

    1. What system call or calls correspond to opening the source and destination files?
    2. What system call or calls correspond to reading the source file and writing the destination file?
    3. What system call or calls correspond to closing the source and destination files?
  7. 3.3: Consider the RPC mechanism. Describe the undesirable circumstances that could arise from not enforcing either the "at most once" or "exactly once" semantics. Describe possible uses for a mechanism that had neither of these guarantees.
  8. Measure the cost of a fork() both with and without exec(). (a) Using gettimeofday(), determine how long it takes for the child to be created, i.e., just before the fork until after the fork(). (b) Then exec() a minimal program that does nothing, i.e., simply has an empty main() and measure how long it takes to execute that program, i.e., until the parent process wait() returns.

Last updated by Henning Schulzrinne