Saturday 23 March 2019

linux - DD from /dev/zero to /dev/null...what actually happens


What happens in the command


sudo dd if=/dev/zero of=/dev/null bs=500M count=1. 

Where do the zeros actually go and in general what happens? The speed is 905 MB/s


If I dd to ramdisk the speed is only 388 MB/s. And if I dd to my hdd the speed is only 63.2 MB/s



Answer



/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.)


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...