gpt4 book ai didi

Linux - 需要将 16 核系统限制为 4 核以测试运行多个程序的性能

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:06:08 25 4
gpt4 key购买 nike

我有几个程序将放在核心有限的系统上。我想在我当前的系统上测试这些程序的性能,该系统比将要使用的系统强大得多。

完全限制适当资源的唯一方法是通过我系统上的虚拟机,还是我可以限制我的系统以满足与我的程序将在其上运行的其他系统相同的核心限制?

最佳答案

taskset 可能对您有所帮助。

启动您的应用程序 your_command,如下所示:

taskset -ac 0-3 your_command
# -c 0-3: your_command might run on cores 0 to 3
# a : all of the 4 cores may be used

如果应用程序已经在运行:

taskset -acp 0-3 PID
# PID = process ID

参见 this answer to 'Limit process to one cpu core' at Unix & Linux了解更多详情。

关于Linux - 需要将 16 核系统限制为 4 核以测试运行多个程序的性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46367473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com