Multi-CPU bindings

Since Solaris 11.2 there is an interesting new feature in regard of binding processes to CPU resources. Before 11.2 you was limited to bind a process to a single CPU or you had to use the processor pool feature. However this had for example the disadvantage that the pools weren’t able to overlap. For example you couldn’t bind a process to processor 0-3 and a second one to to processor 2-7. This made the configurations somewhat inflexible. However since 11.2 you have the concept of so called Multi-CPU binding.

Okay, let’s play a little bit with it. I have a system with 8 CPUs from the OS perspective:

jmoekamp@nfsclient:~$ psrinfo
0       on-line   since 05/07/2017 17:58:36
1       on-line   since 05/07/2017 17:58:36
2       on-line   since 05/07/2017 17:58:36
3       on-line   since 05/07/2017 17:58:36
4       on-line   since 05/07/2017 17:58:36
5       on-line   since 05/07/2017 17:58:36
6       on-line   since 05/07/2017 17:58:36
7       on-line   since 05/07/2017 17:58:37

This is how you have probably already used it:

jmoekamp@nfsclient:~$ pbind -b -c 7 $$
pbind(1M): pid 1430 strongly bound to processor(s) 7..

But now you could assign it to a set of CPUs.

jmoekamp@nfsclient:~$ pbind -b -c 4-7 $$
pbind(1M): pid 1430 strongly bound to processor(s) 7.
pbind(1M): pid 1430 strongly bound to processor(s) 4 5 6 7.

In this case you have strongly bound it to processor 4-7. You have probably guessed it. When there is a strong binding, there are other bindings. For example a weak one.

jmoekamp@nfsclient:~$ pbind -b -w -c 4-7 $$
pbind(1M): pid 1430 weakly bound to processor(s) 4 5 6 7.

Alternatively you could choose a negative binding.

jmoekamp@nfsclient:~$ pbind -b -n -c 4-7 $$
pbind(1M): pid 1430 strongly bound to processor(s) 0 1 2 3.

Simply said the difference between the kinds of binding: A strong binding will ensure that the process will only run on the mentioned CPUs. The negative binding ensures that it will never run on the mentioned CPUs. It’s pretty much just a binding to all other CPUs you have not mentioned in your command line. With a weak binding it will try it’s best to put the process on one of the configured CPUs but after some time it will use other CPUs.

Solaris 11.3 saw the introduction of an additional feature: You are able to assign all processes of a project to a set of CPUs. The configuration is like this:

# pooladm -e
# projadd -K project.mcb.cpus=1-3 -K project.mcb.flags=strong -K
project.pool=pool_default boundedproject
# newtask –p boundedproject 

Given that for example all processes of a user run in a project (which is dependent of the exact configuration, please look here, you could use this quite elegantly to bind all processes of a user to a set of CPUs.