Configuring CPU binding on Linux
The following section describes how to perform various CPU-binding operations in the Linux environment.
The pmdXX process, where XX refers to the program version number, is the root parent process for all other iHub processes, so CPU binding can be done only for pmdXX. Binding must be done before starting the pmdXX process. Binding a running pmdXX process will not take effect.
How to configure CPU binding on Linux
1 In Linux, log in as root and use the less command to view CPU and core information, as shown in the following example:
less /proc/cpuinfo
Use <Ctrl>+<Z> suspend the command.
2 To verify CPUs/cores, use the cat command for more detailed information, as shown in the following example:
sudo cat /proc/cpuinfo.
3 Use the taskset command, referencing the process ID (PID) to verify processor affinity, as shown in the following example:
taskset -p -c PID
Using the -c option provides a processor affinity mask in list form rather than a bit mask for a PID specified using the -p option. For example, a typical affinity list generated by these arguments is 0,2,3-5.
4 Use the ps|grep commands to verify the current core settings for all running processes, as shown in the following example:
ps -e -o pid,cpuid,comm,user | grep clnqa
5 iServer (pmd) <Stop> automatically removes a previous processor binding.
6 To bind CPUs on Linux perform the following tasks:
1 Stop iHub, including the PMD. Make sure no processes are running by typing the following command:
ps -e -o pid,cpuid,comm,user | grep clnqa
2 In a typical installation process, using a text editor such as vi, open the pmd11.sh file located in AcServer/bin and edit the following strings.
Change:
$g_AcRSMyFullPath/$daemon > /dev/null &
to:
taskset 3 $g_AcRSMyFullPath/$daemon > /dev/null &
where taskset 3 is a bit mask representing core #0 and core #1.
Alternatively, when using an archive installation process, using a text editor such as vi, open the startsrvr.sh file located in AcServer/bin and edit the following strings.
Change:
nohup "$AC_SERVER_HOME/bin/pmd11" > $AC_DATA_HOME/server/log/startsrvr.out &
to:
taskset 3 nohup "$AC_SERVER_HOME/bin/pmd11" > $AC_DATA_HOME/server/log/startsrvr.out &
3 Restart iHub. Make sure that all processes started and verify the core to which each process is bound by running the following command:
ps -e -o pid,cpuid,comm,user | grep clnqa
The <taskset> command binds to the number of logical cores. If a machine does not have hyperthreading enabled, you will not see any difference between the physical and logical cores.