COMS W4118 Spring 2008: Homework Assignment 3

Last Updated Mar 2nd 2008

Due Tuesday, March 11th at 9:10 AM (beginning of class)

This homework consists of only one components, the written assignment.

The written components of the assignment is to be done alone, not in teams.  Discussion is encouraged but collaboration is not allowed.

Written Assignment

Exercise numbers refer to the course textbook, Operating System Concepts with Java. Each problem is worth 5 points.

Each problem should be answerable in a few sentences, 5 at most.  Please do not write essays in response to questions.  That demontrates that you do not understand the question.  If you don't understand the question, ask.
  1. Exercise 6.1
  2. Exercise 6.5
  3. Exercise 6.10
  4. Can a thread ever be preempted by a clock interrupt?  If so, how?  If not, why not?
  5. Give an outline of an algorithm that can implement semaphores on a uniprocessor by disabling interrupts.
  6. Show how counting semaphores could be implemented by binary semaphores combined with regular code.
  7. Exercise 5.2
  8. Exercise 5.4
  9. Exercise 5.10
  10. An exponential aging algorithm with alpha = 1/2 is being used to predict future CPU bursts from past CPU bursts of a process. The process has had CPU bursts of 40, 20, 40, and 15 milliseconds (oldest to most recent).  What does the algorithm predict for the next CPU burst?  Assume if that there are no samples, the prediction is zero, and if there is one sample, the prediction is the sample.
  11. On a particular system, assume a context switch takes C time units, and a process takes (on average) P time units before blocking for I/O.  For round-robin scheduling using a quantum of T time units, give a formula for the average CPU efficiency of the system for each of the following conditions:
    1. T = infinity
    2. T > P
    3. C < T < P
    4. T = C
    5. T nearly 0
  12. In the group programming assignment for Homework 2, you were asked to write a system call that makes use of the tasklist_lock to safely access certain data structures. Assuming you had not used this synchronization primitive, how could have the call failed (e.g., crashed the kernel)?
  13. How does the Linux kernel optimize context switches for floating point registers?  Why is this effective?  When would it not be effective?
  14. Why does Linux have a "zombie" process state?  How do you kill a zombie process?
  15. What's the difference between a process and a thread in Linux?
You should submit your assignment via Courseworks->Class Files->Shared Files->HW3_Written_Assignment. Upload your answers in a single ASCII text file.  The filename should be HW3.<uni>.txt  For example, if your uni is sa3152, your submission filename should be HW3.sa3152.txt