DD from /dev/zero to /dev/null...what actually happens
/dev/zero
provides an endless stream of zero bytes when read. This function is provided by the kernel and does not require allocating memory. All writes to /dev/null
are dropped silently.
As a result, when you perform the dd
, the system generates 500 megabytes in zero bytes that simply get discarded. Except for a temporary buffer, no data are stored before, during, or after this operation.
The speed of the transfer from /dev/zero
to /dev/null
is determined primarily by the speed of your processor and relevant system calls. (In your case, the buffer is 500 MB large, and hence the operation tests the speed of your memory as well.)
I will translate this command for you:
dd if=/dev/zero of=/dev/null bs=500M count=1
Duplicate data (dd
) from input file (if
) of /dev/zero
(virtual limitless supply of 0
's) into output file (of
) of /dev/null
(virtual sinkhole) using blocks of 500M size (bs
= block size) and repeat this (count
) just once (1
).
In general, this command should measure just memory and bus speeds. However, it may fail if you do not have 500MB of RAM available. So, in a sense, it also implicitly benchmarks how fast your OS can allocate big memory chunks.
/dev/null is a black hole. It is not accurate for testing normal write operations as it doesn't actually write to disk as a normal file would. Rather than have the head write to disk, the data is discarded immediately upon write to the device, so it will always be faster than normal local writes.
/dev/zero is similar for reads. It does not require head movement to read from, it is just a limitless supply of null characters, so it will always read faster than any local read.
In other words, this is like testing in a void and will not give an accurate picture of what normal local reads and writes should yield.