Activity diagrams -Parallel activities

One of the more useful features of an activity diagram is the ability to show parallel activities. This means it will show what activities can occur at the same time. Concurrent activities allow us to make more efficient use of the resources we have available. For example we could run the bath while we are catching the dog (assuming that the dog is quickly caught otherwise we may have an accident!). To show this we can use something known as a fork and a Join (both are represented as a solid thick black line).

In programming concurrent tasks would be represented as separate processes or as threads. A fork will allow any number of processes to run concurrently and we can also fork more than once before a join. A join must bring together all of the paths of the adjacent fork. Fork’s and join’s must balance in the same way brackets do in programming.

The above activity diagram shows a more complex example of parallel activities. Activity A, B and C all run together. After B has completed activity D and E will then run concurrently. It will not have to wait for A or C to complete before starting D and E. However A,B,C,D and E must all complete before the rest of the program could be executed (not shown on the diagram). This raises a number of important points –