Assignment
Contents:
Overview
Topic: Operating Systems
Related Reading: Ch. 10
Due:
Internet Requirements
You will not need an Internet connection for completing the
assignment, other than for submission.
Practice Problems
Problems to be Submitted (20 points)
- (5 points)
Exercise 42 of Ch. 10 (p. 346)
You are asked to draw a Gantt chart. If you cannot easily mimic the
diagrams from the text, please feel free to report the same
information in whatever way you choose. For example, Exercise 41 of
the text is a practice problem with the answer in the back of the
text. I might choose to typeset that same answer in a table form,
such as:
From To CPU Runs
------------------------
0 120 p1
120 180 p2
180 360 p3
360 410 p4
410 710 p5
- (5 points)
Exercise 43 of Ch. 10 (p. 346)
- (4 points)
If, in a dynamic-partition memory management system, the
current value of the base register is 58712 in decimal, and
the current value of the bounds register is 1587, compute the physical addresses that correspond to the following logical addresses:
- 509
- 808
- 1422
- 2535
- (3 points)
Assume that dynamic partitioning is used for memory management and
that currently there are six empty blocks with respective sizes
38, 85, 51, 99, 77, 27. A new job arrives requiring 52 blocks of
main memory. Which size block would be used be each of the following
partition selection approaches:
- first fit
- best fit
- worst fit
- (3 points)
In a paged memory-management system, the frame size is 1024 and
the following page map table applies to the currently executing
process,
Compute the physical addresses that correspond to the following logical addresses (<page, offset>):
- <3, 297>
- <1, 888>
- <4, 502>
Overall, please type your answers to all of the problems in a
single document to be submitted electronically. Please see details about the
submission process.
Extra Credit (2 points)
All of the CPU scheduling examples given in the text involve the
simpler case when all jobs "arrive" into the system at time 0. In
this problem, we wish to examine the more general case which is when
jobs arrive at differing times.
Consider the following situation:
Job | Arrival Time | Service Time |
p1 | 0 | 40 |
p2 | 0 | 20 |
p3 | 10 | 5 |
p4 | 11 | 1 |
As described in the book, the Shortest Job Next (SJN) CPU scheduling
algorithm is non-preemptive. Therefore, it produces the following
Gantt chart (for simplicity, I'm typesetting the "chart" as the following table):
from | to | CPU runs |
0 | 20 | p2 |
20 | 21 | p4 |
21 | 26 | p3 |
26 | 60 | p1 |
Notice that at time 0, processes p3 and p4 have not yet arrived, and
so of those processes which are ready, p2 is the shortest. It runs
from time 0 to time 20. At time 20, when the scheduler decides on the
next job, p1, p3, and p4 are available, and so p4 is the next to run
as it is the shortest. After that job finishes, then p3 runs, and
finally p1.
What is interesting to note is that SJN is non-preemptive. That is,
at time 10, when job p3 arrives, p3 is even shorter than the job which
is currently running. However, the SJN scheduling algorithm lets
p2 complete. Similarly when p4 arrives.
A common preemptive variant of this is one which is called Shorest
Remaining Processing Time (SRPT). With this scheme, if a new job
arrives with a service time even less than the currently running job's
remaining processing time, then the current job is preempted
in favor of the new job. When any job completes, the scheduler will
next give the CPU to the ready job with the smallest remaining
processing time. So on the above example, the SRPT algorithm produces
the following schedule:
from | to | CPU runs |
0 | 10 | p2 |
10 | 11 | p3 |
11 | 12 | p4 |
12 | 16 | p3 |
16 | 26 | p2 |
26 | 60 | p1 |
Your extra credit task is the following.
Please give the Gantt chart which results from running the SRPT
scheduling algorithm on the following set of jobs:
Job | Arrival Time | Service Time |
p1 | 0 | 15 |
p2 | 0 | 20 |
p3 | 10 | 1 |
p4 | 12 | 13 |
p5 | 14 | 5 |
p6 | 24 | 4 |
Last modified: 5 November 2002