Difference between I_N and S_N in ReentrantRWLockMutexTests?

Adam Retter adam.retter at googlemail.com
Mon Aug 20 04:36:19 UTC 2018

Hi there,

I am trying to learn how to use jcstress to write tests for lock
implementations. I am probably missing something subtle (or even
glaringly obvious), but I can't spot the obvious difference, or the
purpose, between the I_N and S_N test classes in

1. I_N_State appears to construct and use a Non-fair
2. S_N_State uses a reference to a previously declared static final
Non-fair ReentrantReadWriteLock.WriteLock.

It would be useful to know what the "I_" and "S_" prefixes stood for?
At a guess, I am thinking it could be "Instance" and "Static".

I am going out on a limb here, as I am no expert when it comes to the
JMM, but could the difference in the instantiation of the locks be
related to publication visibility of the
ReentrantReadWriteLock.WriteLock object?

(I realise the same applies to I_F vs S_F)

I was also wondering why there are no tests for shared access i.e.
ReentrantReadWriteLock.ReadLock, and mixed access patterns where you
want different threads performing read and write access, possibly also
with lock downgrading?
I noticed that there seem to be far more tests for StampedLock, which
seem to test some of these further capabilities.

Thanks for your time.

Adam Retter

skype: adam.retter
tweet: adamretter

More information about the jcstress-dev mailing list