View Full Version : Concurrency documentation

02-15-2005, 11:31 AM

I have been recently working on a major project which involves threading and concurrency issues. This implementation now needs to be documented(should of been the other way round, but well, I'm a programmer). Does anyone know of a good tool which would show how the threading works with my classes? Would UML do the job?

Thanks for any feedback.

02-15-2005, 11:39 AM
>Would UML do the job?

A UML Sequence diagram can illustrate program flow, but only for particular sequence of execution (hence the name). You could use it to show thread creation and actions being executed in parallel but I think it could get messy. You might be better of just writting a document that expains your synchronization decisions in plain english. I guess it all depends on what kind of documentation you're looking for.

02-16-2005, 06:56 AM
Right ok thanks, I will have a try with the UML diagram some how :-)

02-16-2005, 08:12 AM
If your trying to notate whether a particular method is synchronized or guarded, then you should be able to do so using sequence or interaction diagrams. Also, for the broader picture, activity diagrams can show what steps could be done in parallel.

02-16-2005, 08:29 AM
Perspective, I think sequence diagrams would be pretty good for this stuff. Most of the time, when you have a scenario in your system, you can say this step comes after that step, comes after that step. With parallel threads, you have a particular thread object executing the steps in parallel. Either the scenario spawns a worker thread to accomplish something, or there's some communication between two objects in two different threads. For both he should be able to documentate, either by using the tool's selection of method call semantics or by using stereotypes.

02-16-2005, 09:50 AM
okinrus: yeah, that was my first thought... and thats why i suggested a sequence diagram. But then i thought of a server situation. If he's trying to illustrate 2 parallel threads than a sequence diagram would work fine. But if there are 10 or more threads the diagram will be an incomprehensible mess.

02-16-2005, 10:20 AM
I basically have a master thread which all classes post their messages to, and the particular event that occured through WPARAM and LPARAM. The master thread then filters out these events, as I can have events within events, then these events get posted to my UI thread, and the UI is updated accordigly. Thats the basic framework of the system.

The events are TAPI, SAPI and some others generated from my own classes. Thanks for your advice people.

02-16-2005, 11:14 AM
you could look into two good documentation programs: doors and rational rose