We will not cover the appendix, 7A.
Depending on time, we may abbreviate or skip part or all of 7.6–7.9.
- Speedup of a component.
- Text refers to this as Amdahl's Law, which I've only seen stated in a
more limited form.
- If a system is modified to run faster (or slower), the speedup is just
the ratio of the old speedup to the new: S=To/Tn.
So if the new version takes half as long to complete, the speedup is 2.
The faster the newer version is (the less time it takes), the greater
the speedup.
- We assume that the system speedup results from
speeding up some component of
interest, whose running time changes from to to tn.
The speedup of that component is given as k=to/tn.
- Since the faster system speed is achieved by replacing the old
version of the
COI with the new one,
Tn=To−to+tn.
- The portion of the total (original)
time time
used by the COI is given by f=to/To.
- Put on your algebra hat:
-
- If f is small, a large k doesn't help much.
- Speeding up the CPU doesn't help much if your system is spending most
of its time doing I/O. And conversely.
- Bus Arrangements.
- Fig. 7.1.
- Addressing devices.
- Devices have registers which can be fetched and stored.
- Some registers may contain data being stored, fetched, or displayed.
- Other registers contain device status. Often, individual
bits mean different things: Printer status register may have
on-line, paper present, busy printing, etc.
- Some stores or fetches have side-effects. For instance, storing
printer register may cause the character to be printed.
- Memory-Mapped I/O.
- Some memory addresses are re-directed to device registers.
- CPU can communicate with regular store and fetch instructions.
- Port I/O.
- Device registers are assigned port numbers, an addressing space
separate from memory.
- CPU can communicate with devices using in and out instructions, which
are like store and fetch.
(If you recall, Marie has input and output instructions, but only one
device register.)
- The book confuses these terms with control methods.
- Controlling devices.
- What is needed?
- Devices must be given data to display or record.
- Data from the device must be moved to or the CPU to use.
- Lots of delay and waiting.
- Keystrokes or networking packets arrive without warning.
- There is a long delay between requesting a disk sector and the
availability of the data.
- After a device accepts some data, there may be a long processing
delay before it may accept more, or take some other action.
- Some operations, disks particularly, may involve a series of
steps with waits between.
- Programmed I/O.
- The CPU directly commands all steps.
- It must frequently poll devices so it knows what to do.
- Periodically ask the keyboard if there is a character in its
register.
- After asking for a disk sector, repeatedly ask the drive if the
data is available.
- Very inefficient: CPU wastes a lot of time with “are we there yet?”
- Interrupt-Driven I/O.
- Devices notify the CPU of changes in status.
- Sends an interrupt signal to the CPU. The service routine
manipulates the device.
- The CPU can work on other things while the I/O works.
- For instance, ask the disk for a sector and to interrupt when
available.
- Work on something else.
- When the interrupt occurs, retrieve the contents of the sector.
- Typically, the O/S handles the interrupts and lets a user program
run while waiting on devices.
- Direct Memory Access I/O.
- The DMA controller is a separate processor.
- The CPU gives it a block to transfer. It does so, and
interrupts the CPU when done.
- From the CPU's viewpoint, it groups several interrupting operations
into one.
- I've never seen anyone else put the registers describing the
block in the CPU rather than the DMA controller itself.
- Shared data buses.
- The device that directs the operation of a bus is the
bus master.
- In simplest case, only one device attached to a bus is master, but
here the CPU and DMA must share.
- If the DMA controller is mastering, the CPU will wait. Memory units
can usually wait, but I/O device timing is often critical. Called
cycle stealing.
- Fig. 7.6.
- Channel I/O.
- More advanced DMA controller.
- A channel runs a “channel program”, which allows it to perform more general
operations than the DMA transfer-a-block.
- Block devices.
- Usually disks or other storage devices.
- Transfer a fixed-size block at a time.
- Typically 512 bytes for a hard drive.
- 2K for a CD-ROM.
- Usually can seek a particular block before transfer.
- Tapes are block devices that cannot seek.
- Character devices.
- Transfer a byte at a time. Keyboard, mouse.
- Transfer variable blocks. Network card.
- No seeking.
- Buses.
- Bus structure
- Each horizontal line represents several lines.
- Address and data lines may be shared.
- Synchronous buses.
- Bus uses a share clock which synchronizes all operations.
- One of the bus lines is a central clock which
synchronizes all operations.
- Simplifies operation.
- All connected devices must use the same clock (and be of similar speed).
- Limits either speed or length.
- Asynchronous buses.
- Connected devices have independent clocks.
- Operations must by synchronized using a handshake protocol,
much like a network connection.
- Works better to connect devices of various speeds.
- Timing diagrams.
- Timing diagrams show the handshake interaction. Often, one change
must wait for another.
- Synchronous bus timing diagram
- Asynchronous bus timing diagram (printer).
- Other examples in here.
- Single signals are single lines.
- Bars are groups of signals which are not all the same.
- Transitions are drawn diagonally to indicate that changes are slow
because they are long. “Settle time”.
- Shaded bars indicate that the data need not be valid. No device should
use the contents of the lines during this period.
- Synchronous diagrams show the clock, and operation is divided into
specific periods. Signals change on clock ticks.
- Asynchronous do not have a clock. Signals change in response to
signals from the other end.
- Bus Circuit
- Based on Fig. 7.11.
- The book describes this as a disk bus, but I'm storing things
in a RAM, since there's no disk device in Logisim.
- The RAM controller has some pseudo-random delays, to make the
behavior slightly more disk-like.
- The other controller spends an extra cycle on fetches for no
good reason. I'll try to fix this eventually.
- Serial v. Parallel.
- Parallel buses have multiple data lines; serial has just one.
- Parallel should be faster.
- Trend is to
serial, since the simpler operation seems faster in practice.
- Hard drives.
- Organization
- Sectors.
- Rotate constantly, traditionally 3600RPM. Now 7200 is common.
Also common to spin down automatically if not used for a while.
- Organization
- Data is stored in blocks called sectors, typically 512 bytes.
- Newer disks may have more sectors on outer tracks.
- Sectors are arranged in circular tracks.
- The head can move to any cylinder.
- Tracks located over each other form a cylinder. All the data in
a cylinder can be read without moving the head.
- Cylinders are numbered consecutively from the outside.
- Sectors may not be consecutive around the track; they may be
interleaved.
- Times
- The seek time is how long it takes to move the head to the
desired track (cylinder).
- The rotational delay is the time
waiting for the sector to reach the head.
- The latency is the time to transfer the sector.
- Access time equals seek time + rotational delay.
- Transfer time equals access time + latency.
- Seek time is by far the largest. File systems usually aim to
minimize it.
- Errors.
- The CPU may lose track of the head, in which case it moves to 0 and
starts over.
- Each sector contains a header with its own location and ECC code.
Errors can be fixed or re-reread.
- Disks are manufactured with spare sectors which the controller can
substitute for ones which start to fail.
- CD-ROM
- Designed for music; data an afterthought.
- Bits = Pits & Lands.
- Spiral instead of concentric tracks.
- Constant Linear Velocity (CLV)
- The track moves past the head at a fixed linear rate.
- So the rotational speed much change with the track.
- TIMP(CH07_FIG0718_plim.jpg, Track format (mode 1 for CD-ROM).)
- Chunks of 2352-byte sectors, containing 2048 bytes of data in
mode 1.
- Music is played at 75 sectors per second. Computer CD-ROMs
operate at some multiple; 52x is typical.
- DVD.
- Higher-frequency laser allows smaller pits. (650nm instead of 780nm).
- Can have TIMP(CH07_FIG0720_plim.jpg,
two layers by focusing the laser.)
- Better error correction.
- Blue-Ray/HD-DVD, 405nm laser.
- Writable CDs use a dye layer which changes color under the heat
of a laser.
- RAID
- Multiple disks to improve reliability.
- Level 0
- Simple interleaving: assign blocks in order across the drives.
- Speeds up operations due to parallel operation.
- Actually reduces reliability.
- Strips and stripes.
- Level 1
- Duplicate each stripe.
- Efficiency gains of level 0.
- May be other gains on read if head position is considered.
- Doubles the amount of storage needed.
- Level 2
- Each strip is one bit.
- Hamming codes are error-correcting. Number of drives is logarithmic.
- Any drive that fails can be reconstructed.
- Not often used.
- Level 3
- Similar to level 2, but a single parity bit is kept.
- pk=dk0⊕dk1⊕dk2⊕…⊕dkn
- Exclusive or has the nice property:
x⊕y⊕x=y
- Any single failed disk can be reconstructed.
- One extra disk, but reliability improvement is reduced if you're
too cheap.
- Level 4
- Same idea, but the strip is back to a reasonable size.
- Single parity disk creates a bottleneck on write.
- Level 5
- Changes level 4 to distribute the parity information.
- Read efficiency are similar to level 0.
- Updating parity may be expensive, but..
- The whole stripe can be read in parallel.
- Followed by a write of the update parity.
- This need not delay the caller, since it can happen
after the write. Assuming the system as a whole has
sufficient capacity.
- This level is popular in practice.
- Level 6
- Two different correction disks, one using a different scheme.
- Can survive two disk failures within the repair time.
- Write performance is even worse.
- Other multi-check schemes.
- Supplemental sources.
- Computer Organization and Design by
David A. Patterson and John L. Hennessy, 4th ed., pub. by Morgan Kaufmann.
- A
nice discussion of buses by
Edward Bosworth.