You can use the expansion region element.
How to model N threads doing same thing with activity diagram?
-
29-11-2021 - |
Question
I want to draw uml-correct activity diagram representing process of my raytracer. I know I should use black rectangles to model fork/join. But in my application I spawn N threads doing the same thing (which is not simple and will be modeled via multiple activity elements). How can I draw such activity diagram without having the same thing without knowing number of threads?
My explanation is poor, image may help understand what I want to model with activity diagram
Solution
OTHER TIPS
There is no way I know of to model a fork of N control flows and I found none in three UML2 books nor the UML2.4.1 formal specification (http://www.omg.org/spec/UML/2.4.1/Superstructure).
That said, using an expansion region with the 'parallel' keyword, you can fork N object flows, processing N objects in parallel.
I am, however, not fully satisfied with this solution because I suspect that you don't create N threads because you have N objects to process but because you have N processor cores and that each thread processes a lot of frames (or whatever objects that need processing).
You can, of course, work around this by using the processor cores as objects.