4 ms·
That comment about how /dev/zero used to be used to allocate anonymous pages, anyone have more info? All I could find was a wikipedia article [0] [0] https://e
by doubletwoyou 1y ago
That comment about how /dev/zero used to be used to allocate anonymous pages, anyone have more info? All I could find was a wikipedia article [0]
[0] https://en.m.wikipedia.org/wiki//dev/zero https://en.m.wikipedia.org/wiki//dev/zero
- jeffbee 1y agoThat's it, there isn't any more to know. When the ancient unixes first began to support anonymous maps, they were just hacked into existing code with "zero" as the file, because the only through-line in the unix family history is that the API must be as hideous as it needs to be to accommodate lazy system authors.
- ars 1y agoThere is more to know, does the code special case this? Does it use the file name? Major minor number? Or does it actually read zero's from it and place them in memory?
- convolvatron 1y agoit wouldn't be too hard to look at the source for mmap and zero, but since the topic of this article is the removal of the mmap 'virtual function' in the file, that would have been a pretty good place to throw a zero-page allocation
- mort96 1y agoWait, by "allocating anonymous pages" we just mean memory allocation from the kernel that's used for implementing e.g malloc, right? Did memory mapped files come before memory allocation so that it "made sense" to implement memory allocation as "mapping in /dev/zero"? Or was some amount heap memory always just mapped into the process in early UNIX so that the need to map more pages only appeared as programs started to demand more heap memory than whatever the standard amount was?