4 ms·
Shared memory could be hidden from the users. Passing objects would really be passing control of objects. If process A creates object a, and passes it to proces
by Jtsummers 9y ago
Shared memory could be hidden from the users. Passing objects would really be passing control of objects. If process A creates object a, and passes it to process B, no copying has to happen if the underlying mechanism uses shared memory and access control to effect the transfer (a change of owner).
- spankalee 9y agoYes. Presumably transferrable objects would have to be created on a shared heap. Non-transferrables would live on thread-local heaps.
- pizlonator 9y agoI find that thinking about multiple heaps is harder than thinking about threads. (Ever programmed with scoped memory? It's a nightmare.) I find that thinking about transferrables is harder than thinking about threads. It's gross that an object suddenly loses all of its state just to give that object to another thread. Then, other parts of your code that still want access to that data have to do things that are definitely more gross than acquiring a lock.
- amelius 9y agoYou don't need locks to access immutable objects (except perhaps for garbage collection). But I agree that transferring control is a bad idea.