← Back to context

Comment by mort96

15 days ago

Wait, 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?

In those days malloc would use sbrk to allocate memory. And yes, mmap was designed to memory map files. Using it to allocate anonymous pages came later.

  • Oh, I had never even heard of those syscalls before! Thanks, that makes sense.