|
UNIVERSITY OF WISCONSIN-MADISON
Computer Sciences Department
|
|
CS 537
Spring 2000
| | A. Arpaci-Dusseau
|
| Quiz #9: Wednesday, April 26
|
|
File Systems
Problem 1: Disk Characteristics (40 points)
Consider a disk with the following characteristics:
- Number of surfaces: 16
- Number of sectors / cylinder: 4096
- Number of tracks / surface: 2048
- Number of bytes / sector: 512
a) How many platters does this disk have?
b) How many sectors per track?
c) What is the total size (i.e., capacity) of this disk?
For full credit, please show your work.
Problem 2: Open Files (60 points)
Consider two independent processes A and B that have just started
executing along with per-process and system open file tables with the
following initial contents:
a) Each of the following pieces of data must be kept in
either the per-process open file table or the system open file table.
Determine which of the two locations is most appropriate for each
piece of information. (Hint: This isn't a memorization question. You
should be able to reason through each case.)
- Mode (e.g., RDONLY, WRONLY, or RDWR) used to open the file
- Open file reference count
- Meta-data (also kept on disk) such as file access and
modification time, file size, and pointers to data blocks
- Current read or write position in file
b) Modify the diagram to show the final state of all tables
after the following system calls have executed. Show the names of the
file assigned to each table entry and the
pointers from the per-process table to the system table.
Include the reference count in the appropriate table(s).
Assume that process A and B have the same current working directory
and that all system calls complete successfully.
Process B: fd1 = open("x", mode);
Process A: fd1 = open("y", mode);
Process B: fd2 = open("y", mode);
Process A: close(stdin);
Process A: fd3 = open("z", mode);