Show Table of Contents
A.16. taskset
taskset 工具是由 util-linux 软件包提供的。它允许管理员检索和设置正在运行的进程的处理器关联,或通过指定的处理器关联运行进程。
重要
taskset 不保证本地内存分配。如果您需要本地内存分配的额外性能收益,红帽推荐使用 numactl 来替代 taskset。
设置正在运行的进程的 CPU 关联,运行下列命令:
# taskset -c processors pid
使用处理器的逗号分隔列表或处理器的范围(例如,
1、3、5-7)替换 processors。使用欲重新配置的进程的进程标识替换 pid 。
用指定的关联运行进程,运行下列命令:
# taskset -c processors -- application
用处理器的逗号分隔列表或处理器的范围替换 processors。使用您欲运行的应用程序的命令、选项和参数替换 application。
有关 taskset 的更多信息,请参见手册页:
$ man taskset

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.