It is an interesting idea. For some project of mine (some my know ;), I’m very strongly on the “no two codes on the same machine should do the same, not even if implemented in different languages” side. Which is a bit an extreme view of this.
From my understanding Haiku is already a bit closer to this than many other systems. I think there are a few levels here, which different systems fall into:
- No code deduplication (if you run the same code in two processes it is loaded as two physical copies), e.g. on MS-DOS.
- Code is deduplicated on the file segment level but kept logically independent. E.g. via
mmap(2)used for loading programs, with physical memory being shared if the same thing is loaded. Most systems do this. - “All code is a kind of library”, meaning you can load another program into your process, and then execute (parts of) it. From my (limited) understanding this is where Haiku and 16 bit Windows is.
- “No two codes do the same”, this is what I research, and consider a goal one can only get close to, but never reach.
All of those levels come with benefits and problems. E.g. how to make sure one process cannot overwrite your memory while you’re running (e.g. memory protection flags)? How to make sure code you loaded only has access to it’s own resources (e.g. sandboxing)? How about performance? How to actually find the function you want to call? …
My point here: If you want to explore that outside a lab (like I do), on a real world. real desktop operating system, with real users, then Haiku is already a platform that comes very close. ![]()
Happy hacking everyone!
(PS: Haha, just realised my reply looks like a typical AI generated thingy. Maybe I should change my style to not be confused with AIs! At least last time I checked I was carbon based…)