All, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Robert Haas <robertmh...@gmail.com> writes: > > On Wed, Jun 27, 2012 at 12:00 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > >> Would Posix shmem help with that at all? Why did you choose not to > >> use the Posix API, anyway? > > > It seemed more complicated. If we use the POSIX API, we've got to > > have code to find a non-colliding name for the shm, and we've got to > > arrange to clean it up at process exit. Anonymous shm doesn't require > > a name and goes away automatically when it's no longer in use. > > I see. Those are pretty good reasons ...
After talking to Magnus a bit this morning regarding this, it sounds like what we're doing on Windows is closer to Anonymous shm, except that they use an intentionally specific name, which also allows them to detect if any children are still alive by using a "create-if-not-exists" approach on the shm segment and failing if it still exists. There were some corner cases around restarts due to it taking a few seconds for the Windows kernel to pick up on the fact that all the children are dead and that the shm segment should go away, but they were able to work around that, and failure to start is surely much better than possible corruption. What this all boils down to is- can you have a shm segment that goes away when no one is still attached to it, but actually give it a name and then detect if it already exists atomically on startup on Linux/Unixes? If so, perhaps we could use the same mechanism on both.. Thanks, Stephen
signature.asc
Description: Digital signature