title: How can I effectively represent or model a locking sequence?
body: <p>The problem I am currently solving requires the use of two or more locks (file locks in this case) to avoid concurrency issues.</p>
  
  <p>However I am having trouble representing the (locking) model I will use for the solution.</p>
  
  <p>I.e. I would like to explain the problem and the solution I am coding via some type of diagram that lets me display the locking sequence, the concurrency implications (e.g. if we release this lock before this one we will have this problem, etc) and other such useful information.</p>
  
  <p>What would be a good way to represent lock models? </p>
  
  <p>I have been trying to do so with a flow diagram on one hand, so  I can show the code flow that leads me to either having to obtain a lock or not (e.g. I use an exclusive non-blocking lock to determine if a process is already monitoring a file, and if not I start the monitor), and on the other hand I've been thinking that a sequence diagram would do, but I am not satisfied with the results.</p>
  
  <p>Are there any other visual tools available that would let me represent this problem? </p>
  
  <p>How do engineers solve this issue for really complex problems like distributed systems and such? </p>
  
  <p>Is there any one diagram for this or is it more like a collection of diagrams that are used to describe this?</p>