cgroup-rts-threads-0.2.1.1: A container-/cgroup-aware substitute for the GHC RTS `-N` flag
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Concurrent.CGroup

Description

This module provides a container-/cgroup-aware substitute for GHC's RTS -N flag. See initRTSThreads.

Synopsis

Documentation

initRTSThreads :: IO () Source #

A container-/cgroup-aware substitute for GHC's RTS -N flag.

On most platforms, this sets the number of runtime threads to match the number of physical processors (see getNumProcessors), which is the default behavior of the GHC -N flag.

When running within a cgroup on linux (most often within a container), this observes the current process' cgroup cpu quota to constrain the number of runtime threads.

By default, the number of capabilities is determined by rounding the CPU quota down.

See CPUQuota

initRTSThreadsWith :: RoundQuota -> IO () Source #

Same as initRTSThreads but lets you specify the quota round mode.

data RoundQuota Source #

CPU quotas can be fractions, but the number of RTS capabilities is an integer. This type determines how to round the CPU quota to get to the number of capabilities.

The names correspond to the similarly named methods of RealFrac.