[argobots-discuss] question about ABT_mutex and ULT scheduling

Phil Carns carns at mcs.anl.gov
Wed Jan 6 12:27:03 CST 2021

Hi all,

We've isolated a situation where the ABT_mutex construct is behaving a 
little differently than I expected.  We have two ULTs running on a 
single ES.  The ULTs are using ABT_mutex_lock/free() to protect a shared 
data structure.  This specific configuration will never have lock 
contention (the mutex is really there to protect more complex 
configurations where there are more ESs and ULTs participating than what 
I described above).

Here is what puzzles me: I'm not 100% sure, but it really looks like ULT 
A yields to ULT B when attempting to lock the mutex sometimes, even 
though there is no contention.

This is a performance bug for us; ULT B is only supposed to execute when 
ULT A is idle in this configuration.  We don't really want to give up 
execution when acquiring an uncontested mutex if we don't have to.

I'm sure we could work around it (restructuring our code, or using a 
spinlock or priority mutex or something), but I wanted to ask on the 
list first: is the behavior I described above (a ULT yielding on a mutex 
lock, even if the mutex is available) expected?  Or is it an indication 
that we are doing something wrong somewhere?  I want to make sure that I 
understand the problem before altering the code.



More information about the discuss mailing list