Meziantou.Framework.Win32.Jobs 4.0.3

Prefix Reserved
dotnet add package Meziantou.Framework.Win32.Jobs --version 4.0.3
                    
NuGet\Install-Package Meziantou.Framework.Win32.Jobs -Version 4.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="4.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.Win32.Jobs" Version="4.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Framework.Win32.Jobs" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Framework.Win32.Jobs --version 4.0.3
                    
#r "nuget: Meziantou.Framework.Win32.Jobs, 4.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Framework.Win32.Jobs@4.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Framework.Win32.Jobs&version=4.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Framework.Win32.Jobs&version=4.0.3
                    
Install as a Cake Tool

Meziantou.Framework.Win32.Jobs

Meziantou.Framework.Win32.Jobs is a wrapper for Job Objects. A job object allows groups of processes to be managed as a unit. Operations performed on a job object affect all processes associated with the job object. Examples include enforcing limits such as working set size and process priority or terminating all processes associated with a job.

// Create the Job object and assign it to the current process
using var job = new JobObject();
job.SetLimits(new JobObjectLimits()
{
     Flags = JobObjectLimitFlags.DieOnUnhandledException |
             JobObjectLimitFlags.KillOnJobClose,
});

job.AssignProcess(Process.GetCurrentProcess());

// Start a child process. This process will be terminated if the current process exits
// as the job has the flag KillOnJobClose.
var process = Process.Start("child");
process.WaitForExit();

You can also set limits to the Job Object:

job.SetLimits(new JobObjectLimits()
{
     PerProcessUserTimeLimit = ...,
     PerJobUserTimeLimit = ...,
     MinimumWorkingSetSize = ...,
     MaximumWorkingSetSize = ...,
     ProcessMemoryLimit = ...,
     JobMemoryLimit = ...,
     ActiveProcessLimit = ...,
});

// Restrict UI features
job.SetUIRestrictions(JobObjectUILimit.ReadClipboard);

// Limit CPU
job.SetCpuRateHardCap(2000); // 20% of the CPU
job.SetCpuRate(1000, 3000); // 10% to 30% of the CPU
job.SetCpuRateWeight(5); // 1 to 9

// Network limits
job.SetNetRateLimits(10000); // 10Kb/s

// Security limits
job.SetSecurityLimits(JobObjectSecurityLimit.NoAdmin);

// IO Rate limits
job.SetIoLimits(new JobIoRateLimits
{
    ControlFlags = JobIoRateFlags.Enable,
    MaxBandwidth = 100,
    MaxIops = 100,
    ReservationIops = 100,
});

You can terminate all processes associated to the job:

job.Terminate();
job.Terminate(exitCode: 1);

You can also get accounting information for processes associated with the job:

var basicInfo = job.GetBasicAccountingInformation();
var basicAndIoInfo = job.GetBasicAndIoAccountingInformation();
var memoryInfo = job.GetMemoryAccountingInformation();

Additional resources

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net11.0

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Meziantou.Framework.Win32.Jobs:

Package Downloads
krp

A reverse-proxy for dynamic port-forwarding to Kubernetes

Meziantou.Framework.ProcessWrapper

Fluent API for wrapping System.Diagnostics.Process

MongoDBInstance5_0

Package Description

MongoDBInstance3_4

Package Description

Raccoon.Tools.WindowsJob

Package Description

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Meziantou.Framework.Win32.Jobs:

Repository Stars
Flow-Launcher/Flow.Launcher
:mag: Quick file search & app launcher for Windows with community-made plugins
bitfoundation/bitplatform
Build all of your apps using what you already know and love ❤️
Version Downloads Last Updated
4.0.3 272 9/11/2026
4.0.2 623 9/6/2026
4.0.1 613 9/3/2026
4.0.0 6,916 7/5/2026
3.5.8 1,611 6/28/2026
3.5.7 2,001 6/13/2026
3.5.6 2,238 5/23/2026
3.5.5 1,719 4/25/2026
3.5.4 4,005 1/25/2026
3.5.3 715 1/18/2026
3.5.2 2,113 12/14/2025
3.5.1 753 12/7/2025
3.5.0 2,178 12/2/2025
3.4.12 1,793 11/30/2025
3.4.11 695 11/23/2025
3.4.10 3,546 11/16/2025
3.4.9 1,265 11/9/2025
3.4.8 816 11/2/2025
3.4.7 737 10/26/2025
3.4.6 661 10/19/2025
Loading failed