The odd behavior of /dev/zero
The odd behavior of /dev/zero
Posted Oct 14, 2025 21:07 UTC (Tue) by roblucid (guest, #48964)In reply to: The odd behavior of /dev/zero by iabervon
Parent article: The phaseout of the mmap() file operation
/dev/zero implementations generally has a single page that's cleared and the virtual memory efficiently merely maps that zero page that's shared frequently and COW means writes cause a page fault to get a free page to be dirtied. Once memory over-commit became common, applications
would rely on sparse memory structures not actually using much memory that they had allocated. so there was no going back to the older way where
actual physical swap space was allocated to back what was asked for, because that broke stuff.
would rely on sparse memory structures not actually using much memory that they had allocated. so there was no going back to the older way where
actual physical swap space was allocated to back what was asked for, because that broke stuff.
The big change came with shared libraries, prior to that it wasn't uncommon to link applications commonly used together and have the command name select functionality, thus saving page faults and sharing memory better; even later GNU fileutils was doing the same sharing common code.
