CS170 Homework 5
Homework 5
These problems should be done on your own. As usual, we're not going
to grade these strictly (we'll mainly look at whether you attempted
them).
Page table size
Consider a processor architecture with 32-bit virtual addresses. In this architecture,
the memory management unit (MMU) expects a two-level page table structure.
On this architecture, the upper 6 bits of an address determine the page directory index, the next 10
bits determine the index in the second-level page table, and the bottom 16 bits determine the offset.
-
How many entries are in a page directory? Explain briefly.
-
How many entries are in a second-level page table? Explain briefly.
-
What is the page size on this machine? Explain briefly.
-
What is the maximum number of virtual pages per process? Explain briefly.
Page replacement policy
Suppose FIFO page replacement is used with four page frames and eight pages
and the program accesses the virtual pages in this order:
0172327103.
How many page faults will occur
if the four frames are initially empty? Now repeat this problem for LRU.
Disk performance
Consider a disk with the following characteristics:
- The disk rotates at 12,000 RPM (rotations per minute)
- The disk has 10 platters (and 10 corresponding heads); the cost to
change which head is active is zero
- Each sector is 512 bytes
- There are 1024 sectors per track (we are ignoring the fact that the
number of sectors per track varies on a real disk)
- There are 4096 tracks per platter
- The track-to-track seek time is 0 milliseconds
- If the disk head has to seek more than a single track, the
seek time is given by 1 + t(.003) milliseconds, where t is the number of
tracks that the disk is seeking over.
- Ignore the time to transfer the bits from the disk to memory;
that is, once the disk head is positioned over the sector, the
transfer happens instantaneously.
- What is the storage capacity of the disk in bytes or
gigabytes? (Explain briefly.)
- What is the sequential transfer bandwidth, expressed in
bytes/second or megabytes/second? (Explain briefly.)
- Now assume that the disk with the above characteristics is
given a never-ending stream of requests to
read one sector at a time, with each request chosen randomly from all possible
sectors on the disk. Assume that these read requests are
scheduled in FIFO order. State the effective long-term
transfer rate that the disk can sustain, expressed in bytes/second
or kilobytes/second, and explain briefly.
In doing the third question, the following may be useful:
- You can (and probably should) make several percentage point
approximations, for example 4096 can be represented as 4000, and
13 x 7.5 is approximately 100.
- If we pick a track uniformly at random and then pick another
track uniformly at random, the expected (or average) number of
tracks between them is one-third (not one-half) the total
number of tracks on a platter (this can be derived using probability
theory; OSTEP also gives a derivation.
- The term "long-term transfer rate" refers to R/X, where R is the
number of bytes to transfer in each read, and X is the average length of
time that a read takes.
File systems
Consider a file system that has the following description:
- The disk is divided into 1024-byte blocks.
- The beginning of the disk contains an array of 2^{16} inodes,
each of which can represent a file or be unallocated.
- A file has an indexed structure:
an inode contains (a) 8 data block pointers, each of which is 4 bytes and
each of which points to a disk block and (b)
a pointer to ONE indirect block, which is a disk block that itself contains data block
pointers.
- The inode also contains a userid (2 bytes), three time stamps (4 bytes each),
protection bits (2 bytes), a reference count (3 bytes), and the size (4
bytes).
- A directory contains a list of
(file_name,
inode_number)
pairs, where the file_name
portion is always
exactly 14
bytes, including the null terminator (if the file_name
would
otherwise be fewer than 14 bytes, it is padded to 14 bytes).
-
State the maximum file size, and explain briefly,
for example by showing your work. You may express your answer as a sum
of powers-of-two.
-
State the maximum number of files in a directory, and
explain briefly, for example by showing your work. Again, you may
express your answer as a sum of powers-of-two.
Handing in the homework
Write your answers in a text file. Name the file answers.txt and upload it on
GauchoSpace
Last updated: 2020-03-27 23:24:28 -0700
[validate xhtml]