Multi-threading - Forks and Joins
The Model Simulator provides the ability to handle multi-threaded simulations using Fork and Join nodes.
|·||In the example below, the current execution point has forked into two threads, each with its own active node. |
|·||As this example progresses, the lower branch will wait at the Join node until the top branch has completed all its Actions. |
|·||Once the two threads merge back into one, the Simulation will continue as a single thread until completion.|
|·||When automatically stepping, each thread will be seen to execute a single step during one simulation "cycle" - although when single stepping or at a breakpoint, the behavior is to alternate step between threads as each thread receives processing time. |
|·||Note that the Call Stack window will show two active threads and one "paused" thread in the example below. Once the threads merge there will be a return to single threaded execution.|
|·||Also note that the Local variables are shared (global) between all threads. If you want to Simulate private variables on a thread you must create new Simulation variables at the start of each thread - pre-loading such variables with existing global data. |
Learning Center topics
|·||(Alt+F1 | Enterprise Architect | Simulation | Multithreading | Multithreading Activity Diagram |
The material ("material" includes all pages, documents and on-line graphics) on this web site is protected by copyright law. (C) 1998-2015 Sparx Systems Pty Ltd.