Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个分叉许多子进程的服务器进程。服务器进程与 CPU 核心具有亲和力,但我不希望子进程继承这种亲和力(而是操作系统应该处理在哪里运行这些进程)。有没有办法将父子进程与 CPU 关联性分离?
您可以在 . 之后和之前使用sched_setaffinity(2)CPU 掩码中设置的所有位进行调用。fork(2)execve(2)
sched_setaffinity(2)
fork(2)
execve(2)