Operating Systems (CS 377):
Homework 2
Due: October 7, 2002 23:59
What to Hand In
Everyone must hand in their own work. Place in your Hand-In directory
(~/cs377/hw2) an ASCII file (i.e., raw text) called "README"
that
contains your name, user id, and answers to the questions listed below.
If you use a non-ASCII editor
(e.g., MSword), please make sure that you save your final file in
ASCII format. In MSword, there is a 'save text' option in the
save dialog box. You can check the format on the linux side by using the shell commands 'cat', 'more', or
'less'. Answers need not be more than a few sentences.
Q1. What are the differences between a process and a program; and a process and a thread, respectively?
Q2. What are the differences between I/O bound and CPU bound
process? Describe one typical application that is I/O bound; describe
one that is CPU bound.
Q3. In which situations will a context switch happen? Why do we say that
a context switch is pure overhead? What are the major differences between
a process context switch and thread context switch?
Q4. What are the pros and cons of user-level threads and
kernel-level threads?
Q5. Suppose that the following processes arrive for execution at
the times indicated. Each process will run the listed amount of time.
In answering the questions, use non-preemptive scheduling with zero context
switch overhead and base all decisions
on the information that you have at the time the decision must be made.
Process
| Arrival Time
| Burst Time
|
P1
| 0.0
| 9
|
P2
| 0.4
| 3
|
P3
| 0.8
| 1.5
|
- What is the average turnaround and waiting time for these processes with the
FCFS scheduling algorithm?
- What is the average turnaround and waiting time for these processes with the
SJF scheduling algorithm?
- The SJF algorithm is supposed to improve performance, but notice that we
chose to run process P1 at time 0 because we did not know
that two shorter processes would arrive soon. Compute what the average
turnaround time will be if the CPU is left idle for the first
1 unit, and then SJF scheduling is used. Remember that processes
are waiting during this idle time, so their waiting
time may increase. This algorithm could be known as
future-knowledge-scheduling.
Q6.
Is it possible that on a multiprocessor system, one CPU can execute
one process while another process is performing a context switch?
Why or Why not?
Q7.
Is it desirable for a CPU scheduler to give priority to I/O-bound
threads over CPU-bound threads? Explain your reason using one example.
Q8.
How much time did you spend on this homework assignment?
fagg@cs.umass.edu
Last modified: Tue Sep 24 16:23:47 2002