README editing
[sb-cpu-affinity.git] / README
blobcb4f488d805541040ab48d08a9094cf8bdab59e7
1 SB-CPU-AFFINITY is a simple API to Linux scheduler affinity masks for
2 SBCL. See documentation of symbols exported from SB-CPU-AFFINITY
3 package.
5 Author:
7   Nikodemus Siivola <nikodemus@random-state.net>
9 License:
11   MIT-style. See file LICENSE for details.
13 Bugs and Issues:
15   Currently each call to GET-CPU-AFFINITY-MASK (and
16   WITH-CPU-AFFINITY-MASK) mallocs 128 bytes of memory for the
17   mask, which is never freed by the system -- at least not
18   on the Lisp side: freeing this memory causes glibc to complain
19   about a double-free, and breaks SBCL.
21   Patches and/or explantions for this welcome.
23 Usage example:
25   (asdf:oos 'asdf:load-op :sb-cpu-affinity)
27   (use-package :sb-cpu-affinity)
29   (with-cpu-affinity-mask (mask)
30     (print mask))
32   (with-cpu-affinity-mask (mask :save t)
33     ;; Remove all
34     (clear-cpu-affinity-mask mask)
35     ;; Set CPU 0.
36     (setf (cpu-affinity-p 0 mask) t))
38   (with-cpu-affinity-mask (mask)
39     (print mask))
41   (with-cpu-affinity-mask (mask :save t)
42     ;; Only odd CPUs in mask.
43     (dotimes (cpu (cpu-count))
44       (setf (cpu-affinity-p cpu mask) (oddp cpu))))
45   
46   (with-cpu-affinity-mask (mask)
47     (print mask))