The following call returns quickly:
time dd if=/dev/random bs=1024 count=1
.... 0+1 records in
0+1 records out
49 bytes (49 B) copied, 0.000134028 s, 366 kB/s
real 0m0.004s
user 0m0.001s
sys 0m0.002s
However, if /dev/randomread one byte after another:
for i in {1..500}; do dd if=/dev/random bs=1 count=1 status=none; done
The loop reads a few bytes, then blocks for a few seconds, and then reads a few more bytes. Entering random characters on the keyboard speeds up the process, for example, if the entropy is not enough in the random pool. At the end of the cycle, the cycle takes many minutes.
What makes reading a byte by /dev/randombyte much slower than reading a block from it?
Uname -a:
Linux ... 2.6.32-431.11.2.el6.centos.plus.x86_64
user972946
source
share