Parallel activity : Why is the first branch always executed?

Hello everyone,
I’m currently going through the tutorial lessons, specifically the “Using parallel activity” and while testing around, I noticed that the leftmost child activity is ALWAYS executed, regardless of the parallel activity’s condition.
If I use a boolean as the condition, and it’s already set as true by the time I reach the parallel activity, shouldn’t it just be skipped over during execution ?

Thank you in advance,
Bastien

Hi Bastien,

This is a very common point of confusion, and you’ve made a great observation!

In UiPath, the Parallel activity is designed to start all branches at the same time, without checking any conditions by default. That’s why the leftmost (or any) branch will always start execution, regardless of what conditions you intended.

If you want a branch to be conditionally executed, the best practice is to place an If activity inside that branch to control whether its contents should run. Here’s a simple structure:

Parallel
├── Branch 1
│   └── If myCondition = True
│         └── (Your activities here)

So in your case, even if myCondition is already True, the branch itself still starts, but the activities inside it will only run if the If condition passes.

This approach ensures cleaner control over your logic and avoids unexpected behavior during execution.

Hope this clears things up!

Best regards,
Utkarsh

1 Like

@Bastien_B

parallel activity will start all and the boolean needs to be set to true inside one of the branches so that execution of other branches is halted and to move forward

if you want condition use switch or if

cheers

Hi,

Parallel activity provides with pseudo parallel (not real parallel). So, activities in other branch runs after current branch becomes idle or be completed.

For more detail, the following document in Microsoft site will help you. (As parallel activity is an component of workflow foundation, it’s made by not UiPath but Microsoft)

Regards,

1 Like

Hello Utkarsh,

Thank you for this explanation !

As far as I understand it, the first check for the condition is done after the very first activity, right ?
However, if any branch will start execution regardless of the condition, and all of them are started at the same time, shouldn’t, at least in theory, the first activity of every branch be executed before the condition is checked ?

Is it because it’s pseudo-parallel execution and the first activity to be executed is always the first one on the leftmost branch ?
If so, do you know why the conditional check is performed after an activity and not before ? Is there a performance gain to do it this way ?

Thank you in advance !

Bastien

1 Like

Hello Anil,

I get that it will start all, but my question is more about why only the first activity is executed regardless of the preexisting condition than using conditions on specific branches : If the condition is true before the parallel start, it’d make sense for the whole parallel activity to just skip over, right ?

Thank you in advance,

Bastien

Hi Bastien,

Great questions — you’re absolutely thinking in the right direction!

Yes, in a Parallel activity, all branches start simultaneously, and the first activity in each branch begins execution — even before any conditions are checked. That’s why using an If activity inside each branch is essential for controlling whether the branch’s logic should actually run.

It may seem like the leftmost branch starts first, and that’s correct — UiPath uses pseudo-parallelism (not true multithreading), so branches are scheduled from left to right, but all are technically started at the same time.

As for why UiPath doesn’t check conditions before starting a branch — it’s not about performance. It’s simply by design: the Parallel activity assumes all branches are valid and leaves the logic control to the developer for flexibility and clarity.

In short:

  • All branches start together.
  • First activities run unless blocked by If.
  • Execution appears left-to-right due to internal scheduling.
  • Use If inside each branch for clean, controlled logic.

Hello Yoichi,

I understand that it is not real parallelism, but I don’t understand why the first one is executed without taking the whole parallel activity’s condition into account while all of the others are still submitted to it.
As explained in the link you provided, an activity only starts once the previous one has gone idle or completed and the condition is not true, which is why I wonder why the first activity to be executed is not impacted by the condition.

Thank you in advance,

Bastien

Thank you for the clarification !

I have one last question, if that is okay with you :
I ran a simple parallel logging to check how it worked, and I just don’t understand one thing :
In the screenshot below, only the first activities on the first two branches are executed, and while it does make sense for “Fourth” not to be logged, as it’s the second activity of a branch, why does “Third” not appear in the logs ?

Thank you in advance for your response, sincerely,
Bastien

@Bastien_B

see how parallel works is it creates 3 threads and call each..so basically the condition is check just after it and as its true before executing 3rd thread it stopped

cheers

But then, if 3 threads have been created, why was the check done after for the first 2 threads and before the third ?

@Bastien_B

its not done after two and third and all..its random and its about the time interval

parallel would not work as parallel but one after another

as said thats a random behaviour

cheers

Alright, thank you for that explanation !

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.