1

I started running rsync in three programs at the same time to transfer data between my external hard drive and my internal one. When they finished, I have their timing results:

$ time rsync -a /media/t/1/  ./   
real    236m14.131s
user    22m57.025s
sys     12m35.219s

$ time rsync -a /media/t/2/  ./   
real    106m45.245s
user    3m6.938s
sys     1m25.902s


$ time rsync -a /media/t/3/  ./  
real    55m48.494s
user    2m6.053s
sys     0m52.557s

Is the big difference between real and user+sys mainly because rsync perform mostly IO operations between my external and internal hard drives, and the IO operations are not run in cpu but in DMA or the controllers of the two hard drives, and thus do not count into either user or sys times?

Note that

  • each rsync process is probably multithreaded, which increase user+sys time.

  • at the first half of the time, the three programs run at the same time, competing each other for IO? That may contribute a lot to the real time?

  • The first program transferred 108GB, the second 17GB and the third 12 GB.

  • my OS is 64-bit Ubuntu 14.04, and my computer is Thinkpad T400.

1

The CPU is available for other uses while disk I/O occurs, so it doesn't count towards a process's CPU time (the user and sys figures). That's because, as you guessed, that operation is happening in the disks (likely in more or more microcontrollers soldered to the disk's boards)

  • Note also that subsequent runs will probably have much less IO as the inodes are still in the buffer cache and hence don't need to be read from disk. Use echo 3 > /proc/sys/vm/drop_caches to flush the caches between runs to get a more repeatable (and trustworthy!) result. – wurtel Mar 9 '15 at 15:46
  • by "runs" do you mean my three rsync running programs? Do you mean they will share their inode information in buffer cache of the drives' controller? @wurtel – Tim Mar 9 '15 at 16:35
  • @Tim buffer-cache is stored by the kernel. Its shared by all programs that run on the machine, and persists until you either explicitly flush it or the RAM is needed for something else. – derobert Mar 9 '15 at 16:37
  • by buffer cache, do you mean cpu cache, or something else's buffer/cache? – Tim Mar 9 '15 at 16:39
  • @Tim the kernel uses otherwise-free RAM as disk cache. That's the buffer-cache. – derobert Mar 9 '15 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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