Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
dd if=/dev/zero of=/dev/null bs=2048k count=100000
dd if=/dev/zero of=/dev/null bs=2048k count=100000
dd if=/dev/zero of=/dev/null bs=2048k count=100000
dd if=/dev/zero of=/dev/null bs=2048k count=100000
dd if=/dev/zero of=/dev/null bs=2048k count=100000
dd if=/dev/zero of=/dev/null bs=2048k count=100000

209715200000 bytes (210 GB) copied, 4.2765 seconds, 49.0 GB/s
209715200000 bytes (210 GB) copied, 4.30042 seconds, 48.8 GB/s
209715200000 bytes (210 GB) copied, 4.31607 seconds, 48.6 GB/s
209715200000 bytes (210 GB) copied, 4.29339 seconds, 48.8 GB/s
209715200000 bytes (210 GB) copied, 4.29755 seconds, 48.8 GB/s
209715200000 bytes (210 GB) copied, 4.29938 seconds, 48.8 GB/s

real    0m25.791s
user    0m0.153s
sys     0m25.625s

why do these execute sequentially?

after running them in background -

209715200000 bytes (210 GB) copied, 75.8795 seconds, 2.8 GB/s
209715200000 bytes (210 GB) copied, 75.946 seconds, 2.8 GB/s
209715200000 bytes (210 GB) copied, 76.5718 seconds, 2.7 GB/s
209715200000 bytes (210 GB) copied, 81.5599 seconds, 2.6 GB/s
209715200000 bytes (210 GB) copied, 83.3975 seconds, 2.5 GB/s
209715200000 bytes (210 GB) copied, 83.4965 seconds, 2.5 GB/s

interesting. thanks for the help.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Because you are running them in the foreground - need to put an & at the end of each dd line to background them eg

dd if=/dev/zero of=/dev/null bs=2048k count=100000 & 
dd if=/dev/zero of=/dev/null bs=2048k count=100000 & 
dd if=/dev/zero of=/dev/null bs=2048k count=100000 & 
dd if=/dev/zero of=/dev/null bs=2048k count=100000 & 
dd if=/dev/zero of=/dev/null bs=2048k count=100000 & 
dd if=/dev/zero of=/dev/null bs=2048k count=100000 & 

Alex

share|improve this answer
    
Thanks kindly. :) –  Brandon Mar 2 '13 at 19:49

The shell runs commands one after the other, in the order they are given. If you start a program in background (add & at the end of the pipeline) or if you put it in the backgound (e.g. ^Z and then bg), the processes run in parallel.

Besides, if you run a pipeline of commands (i.e., cmd1 | cmd2 | cmd3), the commands also run in parallel, they only stop when they have to wait for data form the predecessor.

share|improve this answer

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.