Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] System V Shared Memory for Open MPI:Request for Community Input and Testing
From: N.M. Maclaren (nmm1_at_[hidden])
Date: 2010-05-03 11:32:01

On May 3 2010, Jeff Squyres wrote:
> Write a small C program that does something like the following (this is
> off the top of my head):
>fork a child
>child goes to sleep immediately
>sysv alloc a segment
>attach to it
>ipc rm it
>parent wakes up child
>child tries to attach to segment
>If that succeeds, then all is good. If not, then don't use this stuff.

Not quite. You haven't allowed for the ipc rm being scheduled for
immediate effect, but the action not happening immediately - while I
haven't used that facility, I have seen such effects with quite a few
shared facilities. That can happen when the facility is partially
managed by a daemon or kernel thread, that is otherwise engaged at the
time of the ipc rm, and the daemon needs to be called for allocation
and deallocation but not attaching to an existing segment. Is that
ever done for this facility? Dunno. Does POSIX forbid it? Not that
I can see.

To reduce that, I would put in a sleep after the ipc rm, for at least
a few seconds, but that will merely reduce the probability of a race
condition and not remove it. But I don't have a good solution for it,
in general :-(

Nick Maclaren.