views:

187

answers:

5

While debugging an issue with our system, I have discovered a thread contention that is causing a bottleneck. I need to explain the phenomenon to other people involved in handling this issue. Some of them are not from development team (yet, they are reasonably technical). So what type of diagrams can be used to depict threading issues such as contentions, deadlocks etc? Some examples would be very useful.

+2  A: 

The same way one diagrams network communication at the datagram level.

Eg, you draw one timeline for each thread, and then your cross-thread communication consists of lines which connect those timelines at the points of sending on one, and receiving on the other.

Not Sure
You mean a timing diagram?
John Saunders
@John - Yes, I was not aware that was a popular term for such a drawing.
Not Sure
@Not Sure, thanks. Do you have a sample that you can share?
akirekadu
A: 

If it doesn't have to be a diagram you could write simple (verbose) programs. Just like the way any textbooks teach concurrency/deadlock issues.

Rohit
+1  A: 

Wait-for graphs can be useful, which help to diagram the dependencies between resources and threads.

Nick Lewis
+2  A: 

Doug Lea (concurrent programming in Java) uses A vertical time-line with columns for the threads, then a row in the column captures state at any given time.

A succession of rows captures a sequence of events.

The problem is that much of the discssion needs to consider various permutations of possible state changes.

I wonder whether a PowerPoint animated version of these diagrams would help for the audience you have in mind.

djna
A: 

Sequence diagrams from UML are probably the best choice. To show multiple threads, each thread has a vertical bar showing the start and termination (termination is an X at the bottom of the bar), of the thread. Arrows between the vertical bars show messages passed between threads, while an arrow that points back to itself shows the thread making a call on itself.

For some examples, see: http://www.agilemodeling.com/artifacts/sequenceDiagram.htm

Scott Davies