6.3.90.900
cpu-affinity: an FFI binding for getting/setting CPU affinity
(require cpu-affinity) | package: cpu-affinity |
This library contains operations to get and set the CPU affinity mask for a given process on Linux or Windows systems. It does not work on OS X.
procedure
(get-affinity-mask pid) → integer?
pid : integer?
Returns the CPU affinity mask (represented as an integer in which the
bits correspond to CPUs) for a given process identified by its
pid.
Examples:
> (get-affinity-mask 1) 1
> (get-affinity-mask (getpid)) 1
procedure
(set-affinity-mask pid mask) → void?
pid : integer? mask : integer?
Sets the CPU affinity mask for a process identified by its pid
to mask. The mask argument represents an affinity
mask as an integer in which the bits correspond to the CPUs.
Example:
> (set-affinity-mask (getpid) 10) Failed to set the affinity: "Invalid argument"