none
Process.start is slow compared to Powershell Start-Process RRS feed

  • Question

  • I wrote a command line program to create a process and run a simulation in the background. This worked fine for many years but IT pushed something to our computers and it no longer works efficiently.  I use this program to start 200+ simulation runs and as they queued up, they would use 100% loading all my workstation 40 cores until they finished in about 15 seconds. I am not sure what IT pushed to our computers but now I can only get about a 30% usage of my cores and takes 45 seconds to complete.  The program only gets about 12 or so simulations running simultaneously.  So I tried using Start-Process in powershell and low and behold, it would queue up enough simulations to run to load all 40 cores to 100%.  Can anyone tell my how I can get the Process.start to use all of the processing power.  IT does not know what has changed to cause the issue.  It is a policy setting as IT did test a clean computer without the required policy settings and the Process.Start was able to load all of the cores.

    Here is the code I used to start running a single process in C#.

            try
            {
              Process process = new Process();
    
              if (optionHidden)
              {
                process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
              }
    
              process.StartInfo.FileName = application;
    
              process.StartInfo.Arguments = arguments;
    
              process.Start();
    
              if (optionWait)
              {
                process.WaitForExit();
              }
            }
    
            catch (Exception e)
            {
              Console.WriteLine("Failed to launch {0} because of {1}", application, e.Message);
            }
    

    The application name is nStart and looks like this to start all of the simulation runs.

    nStart /hidden nDOF.exe MM0000.ndof
    nStart /hidden nDOF.exe MM0001.ndof
    nStart /hidden nDOF.exe MM0002.ndof
    nStart /hidden nDOF.exe MM0003.ndof

    .

    .

    The powershell script looks like this.

    Start-Process .\nDOF.exe  -ArgumentList 'MM0000.ndof'
    Start-Process .\nDOF.exe  -ArgumentList 'MM0001.ndof'
    Start-Process .\nDOF.exe  -ArgumentList 'MM0002.ndof'
    Start-Process .\nDOF.exe  -ArgumentList 'MM0003.ndof'

    .

    .

    .

    Wednesday, April 18, 2018 5:17 PM

All replies