Parallel Activity issue in Sequence Workflow

Hi To All,

I am using WinFX December CTP and released version of VS 2005. In Sequential workflow, when i tried to use parallel activity with two code activities inside them. The code activities do not seem to be executed parallel manner.

Actually, i put the thread into sleep in first code activities for a specific amount of time.

The result is always, first code is getting executed prior to second code.

Is it a bug or is this way the parallel activity works

Thanks,

Ganesan Krishnamurthy.

 



Answer this question

Parallel Activity issue in Sequence Workflow

  • Jet Stream

    Notre,

    Thanks for pointing this out...I've logged an issue to get this corrected in the documentation.

    If it helps, here's the pseudo code for how the Parallel executes -

    ActivityExecutionStatus Execute(ActivityExecutionContext context)

       foreach(Activity child in this.EnabledActivities)
       {
          register for child's closed status change
          context.ExecuteActivity(child)
       }

    ...

     

    No additional threads are created.  All the children of the parallel are only scheduled for execution.

    Hope this helps!

    Arjun


  • Ian Cummings

    Ganesan,

    This is true - if your scenario doesn't have any nondeterministic activities (i.e. EventSinks that are waiting for some user input), it'll probably run in the same order every time. You shouldn't, however, make any dependencies on the execution order of the parallel.


  • root2

    Arjun,

    Thanks for that information.

    Then, i hope that parallel activity can be renamed into more meaningful like "Independent activities" in release version.

    I ran that test many more times, but order of execution did not change even once.

     

    Regards,

    Ganesan Krishnamurthy.

     

     


  • gallileo

    Ganesan,

    Each workflow instance runs in a single thread.  The parallel activity does not guarantee the order in which it executes its children, but they will not run concurrently.  The parallel construct is particularly useful when you have branches that are blocked waiting for an event or a timer.  For true execution parallelism, you would need to create a new workflow instance and invoke it.

    Arjun


  • Dawnyy

    Hmm.  This is confusing.  According to the Beta 1.2 docs at

    ms-help://MS.WinWF.v1.EN/WinWF_GettingStarted/html/86722377-f04d-4b25-bf50-b26765b79798.htm

    :

    The Parallel activity provides a mechanism by which two or more different actions can take place concurrently but independently

    There is also talk about synchronization of data access.

    Notre


  • Parallel Activity issue in Sequence Workflow