George Mason University
DEPARTMENT OF COMPUTER SCIENCE

CS571 Operating Systems Fall 2001

Assignment A2 (10 points)

Due 9/11/01




Before doing these problems, read Chapters 4 and 5 from Operating System Concepts (or chapters on processes and threads from equivalent books). Also read the slides concerning procedures. Also read the processes part of the CS encyclopedia article. Discuss all parts of this problem with your study partners. Write your own individual report. Acknowledge all sources.

NOTE: Prepare your report with a word processor using a 2" wide right margin to allow for grading.

ALSO NOTE: Explain or justify your answers. A simple "yes" or "no" does not reveal whether you understand or whether you merely guessed right.


(1) Explain the similarities of processes and threads. Explain the differences. State (and justify) guidelines for using threads or processes.

(2) When an interrupt occurs, the hardware makes a procedure call on an interrupt handler (IH) procedure. The activation record of IH is pushed on top of the stack of the process currently running on the CPU. For the example of a disk completion interrupt, explain the main events that occur and why the interruption does not interfere with the running process.

(3) Repeat question 2 for the clock interrupt (used to end time slices and cycle the CPU to the next ready process).

(4) Suppose that a system is started at time 0 with 10 jobs in queue of lengths 1, 2, 3, ... , 10 seconds. The completion time of a schedule is the time at which all jobs are finished. The mean response time of a schedule is the sum of the job completion times divided by the number of jobs; a job's completion time is the time at which that particular job is finished. With the help of diagrams that show which job is using the CPU in different time intervals, compute the finishing time and mean response time for the shortest-job-first (SJF) schedule. Repeat this for the longest-job-first (LJF) schedule. Explain why the finishing times are the same and the response times are different. Is there another schedule with mean response time shorter than SJF? Longer than LJF?

(5) Repeat question 4 for round-robin (RR) scheduling with time slice 1 sec and the jobs initially loaded in the SJF order. What conclusions can you draw about the response-time performance of RR as compared with SJF and LJF? What is the advantage of using RR?