Kdb+ can be constrained to run on specific cores through the setting of CPU affinity.
Typically, you can set the CPU affinity for the shell you are in, and then processes started within that shell will inherit the affinity.
taskset command to limit to a certain set of cores, e.g.
taskset -c 0-2,4 q
will run q on cores 0, 1, 2 and 4. Or
taskset -c 0-2,4 bash
and then all processes started from within that new shell will automatically be restricted to those cores.
You can also use numactl -S to specify the cores, perhaps combined with -l to always allocate on the current node or other policies discussed in the linux production notes:
numactl --interleave=all --physcpubind=0,1,2 q
Other ways to limit resources¶
On Linux systems, administrators might prefer cgroups as a way of limiting resources.
On Unix systems, memory usage can be constrained using
ulimit -v 262144
limits virtual address space to 256MB.
psrset -e 2 q
which will run q using processor set 2. Or, to start a shell restricted to those cores:
psrset -e 2 bash
q.exe with the OS command
start with the
/affinity flag set
start /affinity 3 c:\q\w64\q.exe
will run q on core 0 and 1.