0% found this document useful (0 votes)
34 views

Operating System (CS 604) Fall Semester 2006 Assignment No. 3

The document describes an assignment problem involving process scheduling. Problem 1 involves scheduling two processes, Process 1 which performs work and I/O, and Process 2 which only performs work, under shortest job first preemptive and round robin algorithms. It shows the resulting schedules and completion times of each process under each algorithm. Problem 2 asks why an algorithm that favors processes that have used the least recent processor time would favor I/O-bound over CPU-bound processes, and the solution explains that I/O-bound processes spend most time waiting for I/O so have low recent processor usage, while CPU-bound processes will eventually also have low recent usage if blocked long enough.

Uploaded by

Ali Amir
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Operating System (CS 604) Fall Semester 2006 Assignment No. 3

The document describes an assignment problem involving process scheduling. Problem 1 involves scheduling two processes, Process 1 which performs work and I/O, and Process 2 which only performs work, under shortest job first preemptive and round robin algorithms. It shows the resulting schedules and completion times of each process under each algorithm. Problem 2 asks why an algorithm that favors processes that have used the least recent processor time would favor I/O-bound over CPU-bound processes, and the solution explains that I/O-bound processes spend most time waiting for I/O so have low recent processor usage, while CPU-bound processes will eventually also have low recent usage if blocked long enough.

Uploaded by

Ali Amir
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Operating System [CS 604]

Fall Semester 2006


Assignment No. 3
Total Marks: 40 Dead line: 10-11-2006
Do your own work. If two solutions are found similar, no credit will be allocated to any
of the students. Write to the point answer of the following question.

Problem No.1 [20 pts]


Suppose two processes enter the ready queue with the following properties:
Process 1 has a total of 8 units of work to perform, but after every 2 units of work,
it must perform 1 unit of I/O (so the minimum completion time of this process is
12 units). Assume that there is no work to be done following the last I/O
operation.

Process 2 has a total of 20 units of work to perform. This process arrives just
behind P1.

Show the resulting schedule for the shortest-job-first (preemptive) and the round-
robin algorithms. Assume a time slice of 4 units for RR. What is the completion
time of each process under each algorithm?

Solution:

SJF
Start Time 0 2 3 5 6 8 9 11 28
Process P1 P2 P1 P2 P1 P2 P1 P2

P1 completes (with I/O) at time unit 12. P2 completes at 28.


RR
Start Time 0 2 6 8 12 14 18 20 28
Process P1 P2 P1 P2 P1 P2 P1 P2

P1 completes (with I/O) at time unit 21. P2 completes at 28.


Problem No.2 [20 pts]
Suppose that a process scheduling algorithm favors those processes that have used
the least processor time in the recent past. Why will this algorithm favor I/O-
bound processes, but not starve CPU-bound processes?

Solution:
I/O bound processes generally spend most of their time in the wait queue while
an I/O operation is being performed. When their I/O finally completes, they will
generally not execute for a long time before they initiate the next I/O operation.
Therefore, they will be favored in scheduling relative to long-running processes.
However, if CPU-bound processes are blocked long enough by I/O-bound
processes, they too will eventually not have run for a long time and they will be
scheduled.

You might also like