Author Topic: UML diagrams for multithreaded applications  (Read 733 times)

Shreyansh

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
UML diagrams for multithreaded applications
« on: December 12, 2008, 10:01:05 pm »
I am designing a multithreaded console based application in C/C++ for embedded device. This application is a multithreaded, running 24*7 and dealing with file I/O, TCP/IP and physical communication channel concurrently.
From the available UML diagrams which one will be best suited for such multithread intensive application showing communication between threads and their state

Regards,
Shreyansh Doshi

Werlang

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: UML diagrams for multithreaded applications
« Reply #1 on: December 19, 2008, 01:48:10 am »
I'd use sequence diagrams, but adding synchronization primitives, explicitly in the form of messages, or implicitly with stereotypes.

There's asynchronous messages I could use also.

Is it this what you're looking for?

Regards,
Keep on rockin' in the free world

Shreyansh

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: UML diagrams for multithreaded applications
« Reply #2 on: December 19, 2008, 07:52:14 pm »

Sequence diagrams are some what useful but they doesn’t show complete thread modal of system. I may not help to visualize interaction between threads and various states of thread with respect to time scale.
I have listen about State diagrams and Timing Diagram in UML, are they helpful please suggest.

Regards,
Shreyansh

Werlang

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: UML diagrams for multithreaded applications
« Reply #3 on: December 20, 2008, 02:39:46 am »
Hi!

How would you synch? A semaphore, or a built-in like I believe there's in Java? In my programs I put this way, the threads per se don't know about each other, but share variables likes mutexes. And I'd create one diagram per thread. They'd use the same mutexes in the control flow... Would you like to have all in a single diagram?

I haven't used timing diagrams, but I think it wouldn't be that useful for multi-thread, because you can't predict when threads will colaborate. Not sure but I think timing is more to real time systems. But I'd like to listen if otherwise...
Keep on rockin' in the free world

Shreyansh

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: UML diagrams for multithreaded applications
« Reply #4 on: December 20, 2008, 05:11:07 pm »
Let me clear my scenario again. My application is in C/C++ for embedded device having windows CE 5.0 platform and also it is a real time application running 24*7.

As far as communication between threads, it is done using windows messaging and critical sections. What I also feel that timing diagrams will be the correct solution for me as they shows communication between different threads with respect to time(As i like to show thread interaction with single diagrams since multiple diagrams may confuse some time).

Regards,
Shreyansh


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: UML diagrams for multithreaded applications
« Reply #5 on: December 23, 2008, 06:26:11 am »
Perhaps SysML is a more appropriate platform. There is a SysML add-on available from Sparx, though at extra cost (it is a separate product). You'll find details on the Products page (use the menu at the top of any forum page). I believe there is a trial version.
No, you can't have it!

Krzysztof Swiatkowski

  • EA User
  • **
  • Posts: 76
  • Karma: +0/-0
  • Understanding is a three-edged sword
    • View Profile
Re: UML diagrams for multithreaded applications
« Reply #6 on: January 07, 2009, 09:55:19 am »
Shreyansh, you might use combination. As Werlang suggested you can create one SEQ diagram per thread, then use Combined Fragments and Interaction Occurences to show how exactly those threads interact with each other. Messages may be modeled with 'found message' and critical section with appropriate combined fragment. Depending on what you want to concentrate on and complexity of your threads you may have to partition single thread to several diagram to ease the use of Interaction Occurences.
Timing diagrams may be helpful with showing the state changes and timing constraints.
And single diagrams can also be very confusing as they tend to contain too much information to be useful.

Regards
Kris
If I put you finger in the eye
then you have finger in the eye
and I have finger in the eye
but it's not the same