Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is all data that I copy going through it or is there another more direct way?

share|improve this question
    
The processor is active and in control with USB, but not with firewire (as that card has its own cpu) –  tobylane Feb 4 '11 at 20:58

3 Answers 3

up vote 27 down vote accepted

Tricky one! Data doesn't really go through the CPU per se.

Data and the critical 1's and 0's go through the chipset, or dedicated I/O chips and memory, however, when you are copying files, the command to do the copy gets run by the processor.

Imagine having an object in front of you (the data), your arms (Chipset/I/O chip), and your brain (the CPU). You do not actually use your brain to move the object, your brain runs the "command" to your arms to move the object.

share|improve this answer
    
Nice metaphor, @Wil. –  Shinrai Feb 4 '11 at 16:19
2  
@Shinrai - although, it doesn't stand up if they are psychic! I would love to move the object with my brain! –  William Hilsum Feb 4 '11 at 16:24
    
Didn't DMA or something bypass the CPU? –  Lohoris Feb 4 '11 at 16:30
    
DMA helps by giving the CPU an interrupt whenever an IO command to a block device, such as a USB stick, has completed. The CPU then continues executing the copying. In fact, what the CPU is doing is running kernel-ioctl code that interfaces with the device drivers to copy chunks (the actual name) over DMA. The CPU also handles asynchronous IO and sync IO slightly different from a kernel-code-executing-perspective. –  Henrik Feb 4 '11 at 16:39
1  
I don't do it for the rep, just love this site and helping people! I don't really think it is better as two sentences, but hopefully it is better now.... if you don't like it, I think there is a new thing for lower members, try editing it yourself! –  William Hilsum Feb 4 '11 at 21:11

The CPU has to run the program that reads the source file and then writes the destination file.

The data that's read will (usually) be read into main memory in chunks, but doesn't actually go through the CPU.

share|improve this answer

On a mainframe with intelligent channels, the cpu would just tell the channels to do the copy. Very efficient and allows for fast large backups with little CPU overhead.

Unfortunately, we don't have intelligent channels so the CPU ends up in a loop similar to:

for each file(dev1); do 
   createfile(dev2);
   copyfilecontent(dev1, dev2);
end;

The CPU overhead is not that high unless there are lots of small files, especially lots of files in the same directory. The create file operation usually has the highest overhead. Disk to disk copy just treat each disk as a pre-existing file.

share|improve this answer
    
What are intelligent channels? Could you show a pseudo-code snippet for that? –  Henrik Feb 4 '11 at 16:41
    
Intelligent channels are hardware devices which handle I/O on mainframes. I expect they are limited functionality microcomputers in their own right. No idea what their code looks like. They were very important when mainframes handled 100's of online users in 8MB of memory. I believe Commodore computers used to have a second CPU in their disk systems. They may have had similar functionality. –  BillThor Feb 4 '11 at 17:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.