Number of background processes can be run

doublebeep7's Avatar


21 Nov, 2018 07:55 PM


How many processes can I run using Start-Process command in - ps:? Are they unlimited?

I am asking because in some builds it seems that background processes are two instead of three (three are set).

  1. 1 Posted by Ilya Finkelshte... on 22 Nov, 2018 12:16 AM

    Ilya Finkelshteyn's Avatar

    No they are not limited. How do you count them? I recently dealt with similar problem and I created array of process objects to check. E.g. to start each process run this

      $process = Start-Process -FilePath 'mycommand' -ArgumentList 'arg1', 'arg2' -PassThru
      $script:procs += @($process)

    then check number of running processes with code like this:

    $runningProcs = ($procs | ? {!$_.HasExited}).Count

    Also you can check exit code for each member of that array.

    My suspicion is that one of those three processes fails (but not because if any threading limitations which we do not have).

  2. 2 Posted by doublebeep7 on 22 Nov, 2018 12:32 PM

    doublebeep7's Avatar


    I was thinking the same: that one of the processes fail. I tried to run the processes seperately, but no problem.

    In this build, I tried to run processes one-by-one instead of previous builds (running process of a file which started all of the 26 required processes), but to start all of these processes lasted ~3-4 minutes. Why this?

    @IlyaFinkelshteyn tried your way, variable runningProcs gives 0. Have I done something wrong?

  3. 3 Posted by Ilya Finkelshte... on 23 Nov, 2018 12:29 AM

    Ilya Finkelshteyn's Avatar

    You did not set a PassThru parameter. Also you can RDP and run the thing manually and see what happens.

  4. 4 Posted by doublebeep7 on 23 Nov, 2018 12:47 PM

    doublebeep7's Avatar


    check and . I think that some processes end (as they last ~30secs) during all of these Start-Process commands.

    But why to start 26 processes requires ~5mins? They had to start immediately (~1sec per process).

    I didn't understand this with RDP you said. Where should I connect?

  5. 5 Posted by Ilya Finkelshte... on 23 Nov, 2018 01:19 PM

    Ilya Finkelshteyn's Avatar

    Regarding RDP, please follow the link I sent in previous message. Regarding process start speed, I believe that it is because of number of cores on VM, which has two of them. I think the same happens much faster on your dev box simpler because it is much beefier than build VM. Does this start time prevents you from implementing your scenario, or you just do not like the speed?

  6. 6 Posted by doublebeep7 on 23 Nov, 2018 01:26 PM

    doublebeep7's Avatar

    No worrries, this doesn't prevent me from my project, I would like to make build time shorter.

  7. doublebeep7 closed this discussion on 23 Nov, 2018 01:26 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac