CMSC 412
Midterm #2 (Spring 1998)
1.)
(20 points) Disks: consider
a disk with one surface and 100 tracks recorded evenly spaced between 0.5” to
3.5” from the center of the platter.
a)
Assume that you have a disk that can store 20 sectors per 2π
inches of magnetic media that passes under the disk head, that the disk drive
can have a different number of sectors per track for each track, and fractional
sectors per track. What is the maximum capacity
of this disk in sectors?
b)
Assume the disk can only record at a single density (i.e., the
sectors per track will be the same for each track), and the maximum density is
still 20 sectors per 2π inches, what is the capacity of the disk?
2.)
(20 points)
Synchronization: Recall that binary semaphore can only have values of 0 and 1,
and counting semaphores can have values from 0 to n. Using binary semaphores, show
how you can implement counting semaphores. Please indicate the binary semaphores
and variables used, and their initial values.
3.)
(20 Points) Consider a reference string 1,2,3,4,2,5,7,2,3,2,1,7,8
a)
How many page faults would there be using FIFO replacement and
4 page frames?
b)
How many faults with LRU and 4 page frames?
c)
How many faults using an optimal algorithm and 4 page frames?
4.)
(20 points) Security
a)
UNIX file protection is applied on a per file basis, but AFS
uses per-directory file protection, explain why AFS used per-directory file
protection even though it is based on UNIX.
b)
A user has write privilege to a UNIX directory “goodStuff”,
but not to the file “protected” in the “goodStuff” directory, explain how the
user can still modify the file “protected”.
c)
In an attempt to save storage space, someone suggests that
rather than storing the salt characters for the UNIX password in the password
file that we use the first two characters of the user’s name as the salt. Explain how this would impact the security
of accounts on a single machine and on multiple machines.
5.)
(20 points) File-systems
a)
A UNIX system has just been rebooted (i.e., the file buffer and
name translation caches are empty). What is the minimum number of disk blocks
that must be read to get to the millionth byte of the file “/a/big/file”
assuming the file-system uses 4KB blocks, and 32-bit inode numbers?
b)
Explain why a bit vector implementation of a free block list
can provide increased reliability and performance compared with keeping a list
of free blocks where the first few bytes of each free block provide the logical
sector number of the next free block.