Fall 2002 CSCI 333 Quiz 5 Solution

Problem 1

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

• 20 GB total storage
• 10 surfaces
• 2048 cylinders
• no interleaving
• rotational speed of 10,000 rpm
• track-to-track seek time of 3 msec
• average seek time of 10 msec

The questions

Answer the following questions regarding the disk drive described above.

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

20GB / 512B or 40M

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

2048 * 10 or 20480

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

40M / 20k or 2k

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

1 min / 10,000 or 60,000 msec / 10,000 or 6 msec

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

10 msec + (6 msec/2) or 13 msec

Problem 2

Write a C++ subroutine which is passed an `istream` that has been opened to this file. This routine should attempt to read an integer from the file. It should return -1, if the read request fails or reads a negative number. Otherwise, it should return the number it reads.

```int ReadOne(istream NumS)
```int ReadOne(istream NumS)