Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Have relocatable code be statically linked but stored with a hash. When loading a binary see if common relocatable code is already loaded .. if it has the same hash then it is exactly the same and can be safely shared.

It's not actually "code" which is being shared, but instead the memory pages containing that code (the sharing granularity is a single page, since sharing works by pointing the page table entries on each process to the same physical page). So either you'd have to force page alignment for each and every function (highly wasteful, since the page size is at least 4096 bytes), or you're reinventing shared libraries but using a hash instead of a version.



This is not like shared libraries in that my program is guaranteed to load and run regardless of what libs are on the system. Also, I am guaranteed my program is running with the exact same library I tested it with.


That's finer grained than I imagined. I am assuming hashes for large pieces of code that are completely relocatable in memory.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: