开发者

How to visualize multithreading processes?

开发者 https://www.devze.com 2023-03-23 08:26 出处:网络
I want to model multithreading app behavior. There\'s lot\'s of synchronization (ManualResetEvents etc.). I tried to use sequence diagram but it se开发者_运维技巧ems to lack convenient synchronization

I want to model multithreading app behavior. There's lot's of synchronization (ManualResetEvents etc.). I tried to use sequence diagram but it se开发者_运维技巧ems to lack convenient synchronization visualizations. So what diagram kind I have to use with such kind of tasks?


Have a look at this article

I have been using both the UML activity diagrams and the diagrams in this article

EDIT

To share a bit of experience: do not expect these diagrams to solve all design problems with multithreading. For the same reason that unit testing of multithreaded systems is hard, drawing the diagrams is also though. E.g., have a look at the diagram mentioned in 6.45.Vapuru's answer. Yes, it shows the concurrent execution of the layers and this will help you to pinpoint potential errors but try and visualize what this diagram would look like when attempting to show multiple concurrent clients of the web site. It becomes mess very quickly. I am not saying it can't be done, however the number of possible variations is so huge that it will take a lot of effort to get it right.

This is a nice example to help you understand why multithreading is hard. If you can't draw it, you probably do not grasp its complexity completely, you won't be able to test it and you will always have that nagging feeling you forgot something.

That is why I have my hopes set on platforms and languages to take these issues away but we're not there yet.


If you want to investigate states changes of of the critical objects while they are messaging with each other with timing constraints , you may use UML 2 Timing Diagram

Can check http://www.uml-diagrams.org/timing-diagrams-examples.html site for simple example timing diagram [ Website Latency ]


There is a discussion of different approaches to diagrammatically representing multithreading here. The final form of diagram looks quite well suited to visualizing synchronization using ManualResetEvents.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号