[Mpi3-rma] RMA Example 11.10
balaji at mcs.anl.gov
Thu Jun 13 09:16:47 CDT 2013
On 06/12/2013 08:36 AM, Marc-Andre Hermanns wrote:
>> Why will this deadlock? MPI_WIN_LOCK cannot block for uncontended locks.
> Yes. If the example is just a two-process run, then the lock will not be
> contended, and everything will be fine.
> But what if a reader sees this code snippet not as a two-process example
> but as a two-process snapshot in a multi-process example, where the
> other processes are just not shown.
> And if there are other processes involved, there could be contention on
> the lock, and there is not way for process B to know this in advance.
> The whole thing feels a little bit like dining philosophers, where it is
> not such a good idea to block a resource while you are waiting for another.
>>> Consider a process C that has the same calling sequence as process B. If
>>> C get's the lock granted in MPI_Lock and process B's call to MPI_Lock
>>> blocks to wait for the lock to be granted, C will never release the
>>> lock, as it waits for process B to join the barrier. B, however, waits
>>> for the lock and will never enter the barrier.
>> They are all using SHARED lock.
> Oops. I missed that. Sorry for that.
> Then let's change the process C to have an exclusive lock. ;-)
If you add additional processes doing other things, then yes, it might
deadlock. But that's not the view in most examples. You should view
this as a 2-process test, for illustration purposes.
More information about the mpiwg-rma