You are not logged in.

#1 2009-02-18 13:52:01

Fackamato
Member
Registered: 2006-03-31
Posts: 579

What does this command do?

[root@fackamato-laptop ~]#  dd if=/dev/zero of=/dev/null bs=1M count=100000
100000+0 records in
100000+0 records out
104857600000 bytes (105 GB) copied, 10.5889 s, 9.9 GB/s
[root@fackamato-laptop ~]#  dd if=/dev/zero of=/dev/null bs=1M count=100000
100000+0 records in
100000+0 records out
104857600000 bytes (105 GB) copied, 25.8666 s, 4.1 GB/s
[root@fackamato-laptop ~]#  dd if=/dev/zero of=/dev/null bs=1M count=100000
100000+0 records in
100000+0 records out
104857600000 bytes (105 GB) copied, 16.213 s, 6.5 GB/s
[root@fackamato-laptop ~]#

I know, I mean it reads zeroes into /dev/null in 1MB chunks, but how does it work? What generates the zeroes? Fluctuation is probably because of cpufreq. Is it only cpu-bound or is it memory speed bound too? Just curious... roll

Offline

#2 2009-02-18 14:36:46

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,094

Re: What does this command do?

/dev/zero is an endless stream of 0's


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2009-02-18 14:36:58

scj
Member
From: Sweden
Registered: 2007-09-23
Posts: 158

Re: What does this command do?

My guess that it's pretty much entirely IO bound.

Offline

#4 2009-02-18 15:01:11

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: What does this command do?

scj wrote:

My guess that it's pretty much entirely IO bound.

Yeah sure, but where? cpu<>mem? Or entirely in software? Or cache? Or just pure instr/sec * hz..

Offline

#5 2009-02-18 21:09:15

Arkane
Member
From: Switzerland
Registered: 2008-02-18
Posts: 263

Re: What does this command do?

Cool, this gave me my first occasion to try and understand something in the kernel sources.

From what I've seen, the driver that manages /dev/zero simply puts all zeroes in the char* output buffer it's passed (actually using an asm routine for it, so it's probably as efficient as can be). Piping to /dev/null pretty much does nothing at all.
I can't really follow the call stack to those functions but it's pretty certain it totally bypasses the I/O subsystem.

As for experimental data, dding from zero to null on my machine maxes out my cpu usage and the throughput only depends on cpu availability.

Last edited by Arkane (2009-02-18 21:14:27)


What does not kill you will hurt a lot.

Offline

Board footer

Powered by FluxBB