Franz Kafka
Franz Kafka

Reputation: 10831

UML for multithreading dataflow

I want to paint a diagram where you can see the dataflow of a java program, and if there are one or multiple threads handling the data.

Sequence charts don't show multithreading and get very confusion when you have more than 5 different entities.

Class diagrams are good for showing the relations but the dataflow is missing.

I would like to paint boxes (like class/package diagram) and connect them. Maybe having a box doubled and ... in between to show that there can be more than one thread.

What diagram does UML have for this kind of dataflow diagram?

What editor is good for that diagram? If possible freeware or open source.

Upvotes: 5

Views: 3442

Answers (6)

posthumecaver
posthumecaver

Reputation: 1843

I would tell you something more radical, yes I agree Activity Diagrams are really useful to represent parallel flow but in my opinion State Machines and their diagrams are the ultimate tool to deal with parallel/multi-threaded workflows.

Practically every State Machine you model in Diagrams represents the prallelity and their Events, theirs interaction points.

Please look into this diagram from my Blog. AS you can see Credit State Machine, Credit Score State Machine, Address Check State Machine and Fraud Prevention State Machine, they all work in parallel for Business Case with the help of Apache Kafka.

Upvotes: 0

Toparvion
Toparvion

Reputation: 829

If you want to visualize multiple threads' states (like many profilers do), take a look at PlantUML timing diagrams. It isn't ideal tool for showing many inter-thread communications but suits well for showing transitions between threads' states: Timing diagram example by Adam Rosien

Upvotes: 0

Atul
Atul

Reputation: 1

To show multithreading you can use different colors to show.

For ex red to show one thread and blue color to show different thread

Upvotes: 0

planetjones
planetjones

Reputation: 12633

I would look at athe UML activity diagram for showing multiple threads and their parallel execution. On communication diagrams, you also sometimes see thread letters (e.g. A,B,C) to try and denote concurrent threads, but I almost always find this confusing. There are fragments in UML 2 which may help show concurrency in sequence diagrams, but I always find this cumbersome and the diagrams hard to refactor (which means they quickly go out of date).

If the threads are executing the same tasks, but running in parallel, you could just add a Note to your diagram to explain this. This way you could concentrate on modelling a single thread accurately and cleanly.

With regard to which tool to use most IDEs will have some degree of UML modelling tool included e.g. I am happy to use the EMF based tools which ship with Eclipse.

Upvotes: 6

Robin
Robin

Reputation: 24262

Sequence diagrams do have notation for both parallel operations and asynchronous calls and would be an appropriate means of showing your dataflow.

enter image description here

enter image description here

Upvotes: 5

Paolo
Paolo

Reputation: 22638

Depends on the problem, but I'd probably go with an activity diagram to describe the sequence of events: http://www.agilemodeling.com/style/activityDiagram.htm

Then maybe a set of sequence diagrams to capture the class-level interactions for each of those steps.

Alternatively, you could look at describing the sequence serially (think iterating an array in a loop) and just note that the iteration should be parallelised in implementation.

Upvotes: 3

Related Questions