ResourceLimits Type
Resource limits enforced on a process group **as a whole** (not per process), applied to the kernel container at creation time. Enforcement needs a real container — a **Windows Job Object** or a **Linux cgroup v2**. On macOS and the Linux process-group fallback there is no whole-tree limit primitive, so requesting *any* limit there fails fast with `ProcessError.ResourceLimit` rather than silently leaving the tree unbounded. On Linux the cgroup v2 controllers can only be enabled when this process runs at the real cgroup-v2 hierarchy root (not under a systemd scope, nor in an ordinary container); when they cannot, group creation fails fast for the same reason.
Instance members
| Instance member |
Description
|
Full Usage:
this.CpuQuota
Returns: float option
|
CPU quota as a fraction of a single core (`0.5` = half a core, `2.0` = two cores). `None` leaves CPU unbounded. On Windows this is approximate (converted against the host core count).
|
Full Usage:
this.MaxProcesses
Returns: int option
|
Maximum number of live processes in the tree. `None` leaves the count unbounded.
|
Full Usage:
this.MemoryMax
Returns: int64 option
|
Maximum total memory for the tree, in bytes. `None` leaves memory unbounded.
|
|
A copy with the CPU quota (in cores) set. `cores` must be a finite, strictly positive number — zero, negative, `NaN`, or `PositiveInfinity`/`NegativeInfinity` is rejected (`ArgumentOutOfRangeException`): a non-positive quota could never let anything run, and an infinite one has no meaningful cgroup encoding. Also rejected: a value whose conversion into a cgroup v2 `cpu.max` "quota period" string (see `Native.Cgroup.cpuMaxValue`) would overflow `int64` once rounded to microseconds — the same math is mirrored here (rather than called into `Native.Cgroup`, which compiles after `Limits.fs`) so the rejection is identical on every platform, before a `ProcessGroup` is even created, instead of only surfacing later and only on the Linux backend.
|
|
A copy with the live-process cap set. `count` must be positive — zero or negative is rejected (`ArgumentOutOfRangeException`): the tree always has at least its own leader process, so a non-positive cap could never be satisfied.
|
|
A copy with the memory cap set. `bytes` must be positive — zero or negative is rejected (`ArgumentOutOfRangeException`): a non-positive cap could never let anything run, so it is a misconfiguration rather than a meaningful limit, and previously degraded silently (e.g. a negative value converting to a huge `unativeint` on Windows — effectively "unlimited").
|
Static members
| Static member |
Description
|
|
No limits — the default.
|
ProcessKit API Reference