[X4U] Re: Duplicating?

David Ledger dledger at ivdcs.demon.co.uk
Fri Dec 19 03:06:28 PST 2008


At 00:35 -0500 19/12/08, Jon wrote:
John-

I don't regard $69 for an empty box as particularly cheap. And, while
Firewire 400 may be, in practice, faster than USB2 (though I'd like to
see a citation that shows this), I wonder if the difference would be sig-
nificant for most of us.

I don't have a reference for this, but knowing how it works shows 
that it must be.

An extract from an earlier post of mine on this topic:
<extract>
FW is always better than USB. Whatever rate the bits come/go down the 
wire, with FW the interface dumps/collects the data directly 
into/from system memory; with USB the CPU has to stop what it's 
doing, save state, copy the next byte (or 2 or 4 or 8 ... 4k bytes) 
from/to the interface to/from system memory, restore state, and 
continue what it was doing each time a byte (2, 4, 8, ..., 4k) 
arrives/can be sent. Don't know what the number is, or if it's fixed 
or variable. I've never written a USB driver.
</extract>

Firewire uses DMA (Direct Memory Access), which means that the 
interface hardware itself gets the data into/out of memory at memory 
bus speed. It either uses memory cycles that the main CPU isn't 
using, or tells the main CPU to hold back till it's finished that 
chunk. The main CPU can just carry on after a brief idle, but without 
a context switch. The fact that transfer is complete can be sent with 
a lower priority interrupt that gets handled when convenient.

The only way Apple can get away with using Time Machine to a USB 
drive is because the later machines have more than one core, and so 
one core can do a lot of USB stuff leaving the user unaware. 
Dedicating one core to USB would still be slower than FW because the 
data transfer into/out of memory is still done by a program running 
on that core. That program has to read each instruction from memory 
(or possibly a cache), execute it, read the next ...  The shortest 
program would be (for a disc read and after initialisation):
   read 4 bytes from the interface (for a 32 bit system, 8 bytes for a 
64 bit system)
   write those bytes into memory
   reduce the count of bytes to do by 4 (or 8)
   test if there's still some left to do and back to the top if there are
The memory address to write to would probably be auto incremented 
else there would be another step in the list.
There's no way that that can compete with a DMA transfer.

I understand your feelings wrt the price for a box, but it's not 
actually empty. And you get a $20 power brick, and personally I 
wouldn't use a non-powered external drive except with a laptop that 
travels, with that drive, on a fairly frequent basis.

David


-- 
David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
david.ledger at ivdcs.co.uk
www.ivdcs.co.uk


More information about the X4U mailing list