4 ms·
What if the OS could dedupe pages?
by zingermc 7y ago
What if the OS could dedupe pages?
- kelnos 7y agoDo any OSes actually do this, though? If not, this is academic until one actually does. Linux does have something called "KSM" that de-dupes memory pages, but it appears that it's only so a hypervisor can de-dupe guest OS pages? Odd that it's not more general than that. Though I guess there is a cost: the KSM code needs to scan through memory to find duplicate pages, which I can't imagine is fast.
- loeg 7y agoOn the fly memory dedupe is incredibly expensive. Especially compared to just not duplicating in the first place. Also, it's quite likely that static linked libraries wouldn't be located at the exact same page offsets every time they're linked in to a binary, making page-level dedupe not useful.
- adrianmonk 7y agoYou'd need to arrange for the linking process to result in identical (and identically-aligned!) code pages. If you're going to all the trouble to ensure that, why not just write it all to a file and call it a shared library?
- bayareanative 7y agoExactly. Emperors' new clothes from naive convention abandonment of solved problems.
- sebcat 7y agoWhat if the OS could map a shared object that resides in one section of memory into the virtual address space of multiple processes?
- choeger 7y agoWould not work with any kind of LTO.