shared memory- when the object is destroyed?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Adek336

shared memory- when the object is destroyed?

Post by Adek336 »

What should happen, when the process owning a piece of data decides to unshare it while other processes share the data as well? ??? :o :( :P

Should they be killed at once as they cannot use the data anymore? Should they be killed when accessing the shared data? Should I copy the physical adresses of the data's pages and not dispose them when the first process dies?

Cheers,
~Adrian
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:shared memory- when the object is destroyed?

Post by Pype.Clicker »

that mainly depends on what you plan to do with the object. Imho, an object that is no longer owned by any process should be released (though that's not the way it works in Unix). You could also imagine to receive a signal telling "peer X using the shmem is now gone", and do whatever you want with the info (release aswell, respawn a process, etc.)
Gnome

Re:shared memory- when the object is destroyed?

Post by Gnome »

Unless you want to introduce some sort of persistance into the shared memory, then you should probably have a reference count on them so that when the last user releases it, the memory is freed.
Post Reply