CPU アフィニティ systemd が実行するプロセスの CPU アフィニティを制御するディレクティブの 1 つです。
systemd.exec の man ページから:
# man systemd.exec CPUAffinity= Controls the CPU affinity of the executed processes. Takes a list of CPU indices or ranges separated by either whitespace or commas. CPU ranges are specified by the lower and upper CPU indices separated by a dash. This option may be specified more than once in which case the specified CPU affinity masks are merged. If the empty string is assigned, the mask is reset, all assignments prior to this will have no effect. See sched_setaffinity(2) for details.
CPU アフィニティの構成
1. ファイル「/etc/systemd/system.conf」を編集します 「:
# vi /etc/systemd/system.conf
2.「CPUAffinity」のコメントを外します 」行に追加し、CPU 番号を追加します。
CPUAffinity=2,3
3. サーバーを再起動し、CPU アフィニティのステータスを確認します。
確認
次のコマンドは、プロセスの CPU アフィニティを明らかにします:
# taskset -p [process ID]
# ps --ppid 2 -p 2 -o uname,pid,ppid,cmd,cls,psr --deselect