ThreadJob

1.0.1


PowerShell's built-in BackgroundJob jobs (Start-Job) are run in separate processes on the local machine.
They provide excellent isolation but are resource heavy.  Running hundreds of BackgroundJob jobs can quickly
absorb system resources.

This module extends the existing PowerShell BackgroundJob to include a new thread based ThreadJob job.  This is a
lighter

PowerShell's built-in BackgroundJob jobs (Start-Job) are run in separate processes on the local machine.
They provide excellent isolation but are resource heavy.  Running hundreds of BackgroundJob jobs can quickly
absorb system resources.

This module extends the existing PowerShell BackgroundJob to include a new thread based ThreadJob job.  This is a
lighter weight solution for running concurrent PowerShell scripts that works within the existing PowerShell job
infrastructure.

ThreadJob jobs will tend to run quicker because there is lower overhead and they do not use the remoting serialization
system.  And they will use up fewer system resources.  In addition output objects returned from the job will be
'live' since they are not re-hydrated from the serialization system.  However, there is less isolation.  If one
ThreadJob job crashes the process then all ThreadJob jobs running in that process will be terminated.

This module exports a single cmdlet, Start-ThreadJob, which works similarly to the existing Start-Job cmdlet.
The main difference is that the jobs which are created run in separate threads within the local process.

One difference is that ThreadJob jobs support a ThrottleLimit parameter to limit the number of running jobs,
and thus active threads, at a time.  If more jobs are started then they go into a queue and wait until the current
number of jobs drops below the throttle limit.

The 'using' keyword is not currently supported, and arguments must be passed in using the -ArgumentList parameter.

Added Runspace cleanup.
Show more

Minimum PowerShell version

3.0

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name ThreadJob -RequiredVersion 1.0.1

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name ThreadJob -Version 1.0.1

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Package Details

Author(s)

  • Paul Higinbotham

Cmdlets

Start-ThreadJob

Dependencies

This module has no dependencies.

Release Notes

Updated to include better Runspace clean up

FileList

Version History

Version Downloads Last updated
2.0.3 5,378,369 12/20/2019
2.0.2 11,848 10/24/2019
2.0.1 13,044 6/24/2019
2.0.0 15,313 5/23/2019
1.1.2 40,586 8/14/2018
1.1.1 2,307 6/29/2018
1.0.1 (current version) 259 4/5/2018
1.0 478 1/25/2018
Show less