Priority Type
A portable CPU-scheduling priority for a child process (see `Command.Priority`), mapped onto the native primitive at spawn time: a **Windows** process priority class OR'd into the `CreateProcess` creation flags (the same seam as `Command.CreateNoWindow`), or a **Unix** `nice` value applied via `setpriority` to the spawned process-group leader. Every variant is supported on **both** platform families — `setpriority` is plain POSIX (Linux, macOS, the BSDs alike) and every Windows edition has all five priority classes — so `Command.Priority` never yields `ProcessError.Unsupported`. **How far the priority reaches into the spawned tree depends on the platform and the level.** It always takes on the immediate child on both platforms; whether the child's own descendants (grandchildren) inherit it differs: - **Unix — whole tree, every level.** A `nice` value is inherited across `fork`, so every descendant the leader spawns runs at the requested priority. One honest divergence: the `nice` is applied to the group leader *immediately after* `posix_spawn` returns (there is no `posix_spawn` attribute for it), so a descendant the leader forks in the sub-millisecond window before that call lands keeps the inherited default — the same spawn→apply window the cgroup mechanism already documents. - **Windows — whole tree only for the lowered classes.** The priority class is set atomically at process creation (no spawn→apply window), but Windows only *inherits* a class to grandchildren when it is lowered. Per `CreateProcess`, a child spawned with no priority-class flag defaults to `NORMAL_PRIORITY_CLASS` *unless* its creator is `IDLE_PRIORITY_CLASS` or `BELOW_NORMAL_PRIORITY_CLASS`, in which case it inherits that class. So `Idle`/`BelowNormal` (and `Normal`) reach the whole tree, but for `AboveNormal`/`High` the grandchildren a child later spawns run at `Normal`, not the requested elevated class. The elevation is still honored on the immediate child for all five levels — only its inheritance by grandchildren is the platform limit, and it is never a silent downgrade of the child you launched. Only ordinary (non-real-time) priorities are exposed; `Priority` never raises a real-time class, and I/O scheduling is out of scope.
Union cases
| Union case |
Description
|
Full Usage:
AboveNormal
|
Above the default priority. Windows `ABOVE_NORMAL_PRIORITY_CLASS`; Unix `nice(-5)`. |
Full Usage:
BelowNormal
|
Below the default priority — polite background work that still makes steady progress. Windows `BELOW_NORMAL_PRIORITY_CLASS`; Unix `nice(10)`. |
Full Usage:
High
|
Highest ordinary (non-real-time) priority. Windows `HIGH_PRIORITY_CLASS`; Unix `nice(-10)`. **Unix caveat:** lowering `nice` below its inherited value needs `CAP_SYS_NICE` (Linux) or an equivalent privilege elsewhere. Without it the OS refuses the change and the spawn fails with `ProcessError.Spawn` — it is never silently downgraded to a lower priority. Windows needs no special privilege for the high class. |
Full Usage:
Idle
|
Lowest scheduling priority — runs only when the system is otherwise idle. Windows `IDLE_PRIORITY_CLASS`; Unix `nice(19)`. |
Full Usage:
Normal
|
The default OS priority — Windows `NORMAL_PRIORITY_CLASS`, Unix `nice(0)`. When the launching process itself runs at the default priority (the usual case), setting this is functionally equivalent to not calling `Command.Priority` at all. It maps to an *absolute* target, not a "leave as inherited": on Unix it is `setpriority` to nice `0`, so under a launcher that is itself niced above `0` it lowers the child's nice back to `0` — which needs privilege exactly as `AboveNormal`/`High` do (and fails the spawn without it, never silently) rather than keeping the raised nice. |
Instance members
| Instance member |
Description
|
Full Usage:
this.IsAboveNormal
Returns: bool
|
|
Full Usage:
this.IsBelowNormal
Returns: bool
|
|
Full Usage:
this.IsHigh
Returns: bool
|
|
Full Usage:
this.IsIdle
Returns: bool
|
|
Full Usage:
this.IsNormal
Returns: bool
|
|
ProcessKit API Reference