I am emptying out a hard drive on some Linux 4.x OS using this command:
sudo sh -c 'pv -pterb /dev/zero > /dev/sda'
And I opened another tty and started sudo htop
and noticed this:
PID USER PRI NI CPU% RES SHR IO_RBYTES IO_WBYTES S TIME+ Command
4598 root 20 0 15.5 1820 1596 4096 17223823 D 1:14.11 pv -pterb /dev/zero
The value for IO_WBYTES
seems quite normal, but IO_RBYTES
remains at 4 KiB and never changes.
I ran a few other programs, for example
dd if=/dev/zero of=/dev/zero
cat /dev/zero > /dev/zero
and was surprised to see none of them generates a lot of IO_RBYTES
or IO_WBYTES
.
I think this is not specific to any program, but why don't reads from /dev/zero
and writes to /dev/{zero,null}
count as I/O bytes?
/dev/null
don't end up interfacing wich such hardware and don't clog I/O buses. Taken to the extreme; are reads/writes to/from memory also I/O? Of course, there is no hard delineation for these things, and it all depends on which perspective you take in these things, and how useful that perspective ends up being to you./dev/{null,zero}
(which usually isn't a bottleneck). That's just my perspective though :)read(2)
andwrite(2)
counts as I/O, which is very reasonable in its own sense.