UML Diagrams of Multi-Threaded Applications

Posted by PersonalNexus on Programmers See other posts from Programmers or by PersonalNexus
Published on 2011-11-21T09:46:14Z Indexed on 2011/11/21 10:19 UTC
Read the original article Hit count: 289

For single-threaded applications I like to use class diagrams to get an overview of the architecture of that application. This type of diagram, however, hasn’t been very helpful when trying to understand heavily multi-threaded/concurrent applications, for instance because different instances of a class "live" on different threads (meaning accessing an instance is save only from the one thread it lives on). Consequently, associations between classes don’t necessarily mean that I can call methods on those objects, but instead I have to make that call on the target object's thread.

Most literature I have dug up on the topic such as Designing Concurrent, Distributed, and Real-Time Applications with UML by Hassan Gomaa had some nice ideas, such as drawing thread boundaries into object diagrams, but overall seemed a bit too academic and wordy to be really useful.

I don’t want to use these diagrams as a high-level view of the problem domain, but rather as a detailed description of my classes/objects, their interactions and the limitations due to thread-boundaries I mentioned above.

I would therefore like to know:

  1. What types of diagrams have you found to be most helpful in understanding multi-threaded applications?
  2. Are there any extensions to classic UML that take into account the peculiarities of multi-threaded applications, e.g. through annotations illustrating that
    • some objects might live in a certain thread while others have no thread-affinity;
    • some fields of an object may be read from any thread, but written to only from one;
    • some methods are synchronous and return a result while others are asynchronous that get requests queued up and return results for instance via a callback on a different thread.

© Programmers or respective owner

Related posts about architecture

Related posts about uml