I want to verify semantics of a library of atomic primitives that I wrote. The idea is, only if the semantics of all the primitives are consistent with each other, an application that uses them could behave predictably.
For example, a composition of a primitive Fx(lck) which takes exclusive lock on an lck object could be - Fx(Fx(lck)). But this could lead to a dead lock when operated on a single thread. This is a valid scenario if lck is a non-recursive lock.
I wonder if I could create a Petri Net model of my primitives to check if they are present a perfect synchronization tool.
You can also propose an alternate solution.