CS372H Spring 2010 Homework 10
Problem 1:
You are designing a program to automate
the publication of stock data in the Greedy
Stock Exchange system. To simplify the design, the structure of the application
is such that the stock data file will be shared in read-only mode among the
processes that are used by brokers, while the exchange manager will run a
different process that can update the stock data. All processes will run on the
MegaGiga mainframe system running the Solaris operating system. Using the
system calls mmap(), mprotect(), and any other call you deem necessary, explain
how the processes can share the stock data file as required. Show how the
system calls will be used and explain the arguments that will be used to
establish the solution.
Problem 2
In some operating systems, IO from/to disk is done directly to/from
a buffer in the user program's memory. The user program does
a system call specifying the address and length of the buffer
(the length must be a multiple of the disk record size).
The disk controller needs a physical memory address, not a virtual address.
Ben Bitdiddle proposes that when the user does a write system call, the
operating system should check that the user's virtual address is
valid, translate it into a physical address, and pass that address and the
length (also checked for validity) to the disk hardware.
This won't quite work. In no more than two sentences,
what did Ben forget?
Problem 3
Suppose
a server workload consists of network clients sending 128-byte requests to a
server which reads a random 50KB chunks from a server's file system and
transmits that 50KB to the client. The server's file system is able to cache
all metadata, so that each read consists of a single 50KB sequential read from
a random location on disk. The server may have multiple disks and multiple
network interfaces.
Each
disk rotates at 10000 RPM and takes 5 ms on an average random seek. There are
on average 300 sectors per track and each sector is 512 bytes (in actuality,
the number of sectors per track will vary, but we'll ignore that. We'll also
assume that each request is entirely contained in one track and that each
starts at a random sector location on the track.)
To
access disk, the CPU overhead is 30 microseconds to set up a disk access. The
disk DMAs data directly to memory, so there is no CPU per-byte cost for disk
accesses.
Each
network interface has a bandwidth of 100 Mbits/s (that's Mbits not MBytes!) and
there is a 4 millisecond one-way network latency between a client and the
server. The network interface is
full-duplex: it can send and receive at the same time at full bandwidth. The
CPU has an overhead of 100 microseconds to send or receive a network packet.
Additionally, there is a CPU overhead of .01 microseconds per byte sent.
- How many requests per second can each disk satisfy?
- How many requests per second can each network interface satisfy?
- How many requests per second can the CPU satisfy (assuming the system has a
sufficient number of disks and network interfaces?)
- What
is the latency from when a client begins to send the request until it receives
and processes the last byte of the reply (ignore any queuing delays).
Problem 4
Sun's network file system (NFS) protocol provides reliability via:
- at-most-once semantics
- at-least-once semantics
- two-phase commit
- transactions
Which is the best network on which to implement a remote-memory read
that sends a 100 byte packet from machine A to machine B and then sends a
8000 byte packet from machine B to machine B?
- A network with 200 microsecond overhead, 10 Mbyte/s bandwidth,
20 microsecond latency
- A network with 20 microsecond overhead, 10 Mbyte/s bandwidth, 200
microsecond latency
- A network with 20 microsecond overhead, 1 Mbyte/s bandwidth, 2
microsecond latency
- A network with 2 microsecond overhead, 1 Mbyte/s bandwidth,
20 microsecond latency
Problem 5
True or false. A virtual memory system that uses paging is vulnerable
to external fragmentation.
Problem 6
True/False Shortest positioning time first (SPTF), in which a disk scheduler
selectes as the next block to fetch the block for which the (rotational time + seek time) is
minimal is the optimal disk scheduling algorithm with respect to response time.