cpu-affinity:   an FFI binding for getting/  setting CPU affinity
get-affinity-mask
set-affinity-mask
6.12

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:

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"