CSCI 333 Homework 5 Solution

This homework is not graded. It is practice for Quiz 5.

Problem 1

Consider an old-fashioned unzoned disk drive with the following characteristics.

The questions

Answer the following questions regarding the disk drive describe above.

  1. How many 512 byte sectors are on this disk drive?

    It's disk capacity divided by sector size; that is,16M or 8G bytes/512 bytes

  2. How many total tracks (on all cylinders) are on this disk drive?

    It's the number of surfaces multiplied by the number of cylinders; that is, 16k or 8*2048

  3. How many sectors are stored on each single track?

    It's the number of sectors on the disk divided by the number of tracks on the disk; that is, 1k or 16M/16k.

  4. How many sectors are stored on each cylinder?

    It's the number of sectors per track multiplied by the number of surfaces; that is, 8k or 8*1k.

  5. How long, in msec, does it take this disk to rotate?

    It's the inverse of the rotational speed; that is, 10 msec or 1min/6000 or 60sec/6000 or 1/100 sec.

  6. How many bytes can be read in one disk rotation?

    It's the number of sectors per track multiplied by the number of bytes per sector; that is, 512k or 1k*512.

  7. What is the average rotation delay in reading from the disk?

    It's one-half the time required for the disk to rotation; that is, 5msec or 10msec/2.

  8. What is the average time, in msec, required to read a random sector of data from the disk?

    It's the average seek time plus the average rotation delay; that is, 18 msec or 13msec plus 5msec. Note: We are ignoring the very small transfer time required to read a single sector.

  9. If a 80Mbyte file could be stored in consecutive sectors of the disk, how many cylinders and tracks would it require?

    An 80Mbyte file can be stored in 160k 512-byte sectors. Since there are 8k sectors per cylinder, 20 cylinders would be required.

  10. How long would it take to read this 80Mbyte file stored in consecutive sectors?

    Assuming the head is already positioned on a track, we can read its data on one revolution or 10msec. To read an entire cylinder would require 8 revolutions, or for each surface. This would be 80msec. Thus is would require 1,600 msec to read all twenty cylinders, if you ignore seek time. On the average the time for the first seek would be 13 msec and the track-to-track time for the remaining 19 seeks would be 4*19 or 96 msec. So, a bit over 1,700 msec would be required.

Problem 2

Suppose you are using hashing with a hash table of size 8 with the very simple hash function, H(x) = x%8. Draw the result of adding the following values into the table using both open and closed hashing.

  1. 431
  2. 333
  3. 805
  4. 400
  5. 253
  6. 880
closed hashing
400
253
880
 
 
333
805
431

And here is open hashing! Don't you love those colors!
Closed hash table

Problem 3

Suppose you are building a skip-list which will contain records consisting solely of integers. Show the result of building the skip-list using the same data values as show in Problem 2. You answer will depend on your coin tosses.

My coin tosses were: 431, H, H, H, T; 333, T; 805, T; 400, H, T; 253, T; and 880, H, T:
Skiplist

Problem 4

Show how to remove 333 and 431 from the list your constructed in Problem 3.

Skiplist with 333 and 431 removed