Using the ParallelActivity Activity
The ParallelActivity activity lets you schedule two or more child SequenceActivity activity branches for processing at the same time. Although branch SequenceActivity activities are scheduled to start processing at the same time, they do not start processing at the same time. Processing begins with the execution of one activity that is contained in one of the SequenceActivity branches. When that activity is completed, the next activity in sequence in another branch executes, and so on. Activity execution switches between the SequenceActivity branches, with one activity executing at a time until all the SequenceActivity branches finish executing. This completes the processing of the ParallelActivity activity. ParallelActivity does not guarantee the exact order of execution across the SequenceActivity branches.
If a SequenceActivity branch contains an activity such as a blocked DelayActivity activity, execution does not stop and wait for the activity to be unblocked. Instead, the next activity in sequence in the next SequenceActivity branch is executed.
Although the SequenceActivity child branches are processed at the same time, the branch activities do not execute in a true concurrent manner. The Windows Workflow Foundation runtime uses one thread per workflow instance. All the separate branches in the ParallelActivity activity share the same single workflow instance thread. Therefore, only one activity of one branch executes at a time.
For more information, see the ParallelActivity class of the System.Workflow.Activities namespace in the Windows Workflow Foundation Class Library reference.
For a code sample that demonstrates how to use the activity, see Using While and Parallel.