Assignment 1
Assignment 1
Where to Hand it in: In the metal hand-in box #10 in room ICCS X235 where the other new,
metal hand-in boxes are located. This is also the place to hand in late assignments. Note that we
are no longer using the old wooden hand-in boxes in the ICCS basement.
Late Penalty: 20% (of the assignment’s maximum value) per school day, where 11:00 AM to
(next day’s) 11:00 AM is the extent of one school day for this assignment. For example, if you
submit your late assignment to the hand-in box by Friday, January 25 @ 11:00, then that’s a 20%
deduction (so, if you would have gotten 90% if you were on-time, you’ll now get 90-20=70%).
Weekends count as one day.
The assignment you submit should be done on your own, not in pairs or groups, and not copied
from any other source. You can discuss questions with each other as long as you don’t copy
answers. Please refer to the UBC CPSC rules on plagiarism if you have any questions.
NOTE: For all of the calculation-based questions in this assignment, show your work;
otherwise, you may get no marks. In case of ambiguity, write down any (reasonable)
assumptions that you make.
1. How long does it take, in the worst-case, to read a specific page X on this disk drive,
when you’re currently at some random point (elsewhere) on the disk drive?
4. If we reserve table space for 30 cylinders’ worth of Personnel data, how many records
can we store?
6. What is the transfer rate (in megabytes per second) for transferring (reading) one entire
track? Let us assume that we can start reading immediately, rather than waiting for the
“start” of the track to come around (because we’re going to read all of those pages
anyway, and we can rearrange the ordering in memory). Assume that you’re on the
correct cylinder, and there is no rotational delay.
7. Suppose we had to read 1,000 Personnel records, each of which appeared on a different
page (your choice of contiguous pages or worst-case page placement—just specify your
assumption), and we were reading the records, one page at a time. How long would it
take to read these 1,000 Personnel records from disk?
8. If there is no index on the address field, how long (in milliseconds or seconds) would it
take to bring the requested data pages into the buffer pool to allow us to answer the
following SQL query, assuming the head is on a non-Personnel cylinder (i.e., somewhere
far away)? Assume that there is no order to the records, and that there are 25,000 pages
stored contiguously.
SELECT count(*)
FROM Personnel
WHERE address contains “Richmond”;
1. List the names, ages, and ratings of all sailors who have reserved a boat called “Titanic”.
Assume that dates are integers in the format yyyymmdd.
2. List the names of the sailors who reserved a blue boat in July or August of 2012, and
whose rental rate (for that same boat) was more than $50 per hour or more than $300 per
day. In addition to the names of the sailors, include the name of the boat.
Assume that there are 3 page frames available in memory. Construct a table to show
which pages are present in the buffer pool as each request is serviced (just like in class),
and determine the number of page faults that occur, and when the writes occur.
Remember that all frames are initially empty, so your first reference to a given page will
always result in a page fault.
2. Apply the same reference string as in Question 1 to an initially empty buffer pool, using
the LRU Algorithm (for which we don’t pay attention to dirty bits).
Assume that there are 3 page frames available in memory. Construct a table to show
which pages are present in the buffer pool as each request is serviced, and determine the
number of page faults that occur. Remember that all frames are initially empty, so your
first reference to a given page will always result in a page fault.
3. Re-write the Clock Algorithm (the one without a dirty bit, from class) so that it uses a
reference bit/field (RB) that takes on values of more than just 0 or 1. In other words,
assume that the RB can take on values of 0, 1, 2, …, k to account for k active, but
different transactions. If we have trouble finding a victim on the first pass, note that we’d
cycle through, as needed—and eventually get to 0 to find a valid victim. Make
reasonable assumptions.