NOTE: These notes are by Allan Gottlieb, and are reproduced here, with superficial modifications, with his permission. "I" in this text generally refers to Prof. Gottlieb, except in regards to administrative matters.


================ Start Lecture #16 (Apr. 14) ================

Backups

Three distinctions: A physical dump can only be done with a full dump and a full restoration. A logical dump can be done with any combination of full or incremental dump and with full or incremental restoration.

Physical vs. Logical dumps.

Physical dumps: Start at beginning of disk and copy through to the end.
Full restoration: Copy back into disk. Disk ends up in exactly the same state as when dumped.

Logical dumps

Dump type:

Restoration type:

The result of a full restoration is that the file structure returns to its previous state, but the actual location of disk can be entirely different. Tricky issues in logical dumps: Tanenbaum says that the free list is a problem, but I don't see this: The restoration process should manipulate the free list like any other process that creates and destroys files.

When any kind of dump or restoration is taken place, the file system must be "frozen": no changes are allowed, for fear of creating inconsistencies. Since full dumps can take a long time, this is a substantial constraint.

Physical dumps are preferred:

Logical dumps are preferred

Restoring

Full restoration: Go back to last full dump, reload, reload all incremental dumps since in sequence.
Restoring 1 file F: Delete current version of F, find most recent incremental dump when F was saved, load F.

Consistency

Possible types of inconsistency:

RAID

Redundant Array of Inexpensive/Independent Disks

Various schemes to use multiple disks to improve speed and/or reliability. Different schemes are misleadingly called "levels".

Only the disk controller knows the difference between a RAID system and a simple disk. As far as the disk driver is concerned, it's just another random-access information storage device. As I said before, device independence really does work over this class of devices. Let K be the number of disks. Let T be a time small enough that it is very unlikely that two disks will fail within time T. Let F be the probability that a disk fails within time T.

RAID Level 0: Striping

Block I goes to disk I mod K.
Speed of reading and writing large file improves by factor of K.
Probability of failure within time T = F*K (i.e. the system become K times more unreliable.)

RAID Level 1: Mirroring

K/2 primary disks, K/2 backup disks. Stripe over primary disks.
Each backup disk identical to corresponding primary disk.
Speed of reading large file improved by factor of K: Simultaneously read different block from each disks.
Speed of writing large file improved by factor of K/2 (book is mistaken in saying no improvement.) Simultaneously write block to K/2 [disk, backup] pairs.
Probability of failure within time T: (K/2)*F2.
(Fix disk when failure occurs.)

Level 3:

One of the normal RAID methods is to have K-1 data disks and one parity disk. Data is striped across the data disks and the bitwise parity of these sectors is written in the corresponding sector of the parity disk.

On a read if the block is bad (e.g., if the entire disk is bad or even missing), the system automatically reads the other blocks in the stripe and the parity block in the stripe. Then the missing block is just the bitwise exclusive or of all these blocks.

For reads this is very good. The failure free case has no penalty (beyond the space overhead of the parity disk). The error case requires N+1 (say 5) reads.

A serious concern is the small write problem. Writing a sector requires 4 I/O. Read the old data sector, compute the change, read the parity, compute the new parity, write the new parity and the new data sector. Hence one sector I/O became 4, which is a 300% penalty.

Writing a full stripe is not bad. Compute the parity of the N (say 4) data sectors to be written and then write the data sectors and the parity sector. Thus 4 sector I/Os become 5, which is only a 25% penalty and is smaller for larger N, i.e., larger stripes.

A variation is to rotate the parity. That is, for some stripes disk 1 has the parity, for others disk 2, etc. The purpose is to not have a single parity disk since that disk is needed for all small writes and could become a point of contention.

Level 2

Same as level 3, but with full Hamming code rather than just 1 parity bit. Allows you to correct unreported error in 1 bit, or detect error in two bits.

5.5: Clocks

Also called timers.

5.5.1: Clock Hardware

5.5.2: Clock Software

  1. TOD: Bump a counter each tick (clock interupt). If counter is only 32 bits must worry about overflow so keep two counters: low order and high order.

  2. Time quantum for RR: Decrement a counter at each tick. The quantum expires when counter is zero. Load this counter when the scheduler runs a process.

  3. Accounting: At each tick, bump a counter in the process table entry for the currently running process.

  4. Alarm system call and system alarms:
  5. Profiling

Keyboard

Keyboard controller reports each pressing of a key and each release of a key as an "event" to OS; everything else is done in OS software. Maximal flexibility. Keyboard driver ordinarily reports a sequence of characters to the user process.

Mouse

Reports distance in units of 0.1 mm in each direction (X,Y). Software keeps track of position by dead reckoning. OK, because of monitor feedback.

Monitor

A monitor has M x N (e.g. 1024 x 768) pixels, each of which has three displays (Red, Green, Blue) of intensity 0 ... 255 (8 bits) Each pixel refreshed 50 or 22 times per second. Monitors are characterized by: The last two properties are key to the very high degree of compression achievable for video.

CPU writes to video RAM; Video controller scans video RAM continuously.