Is it possible to force an existing Java application to use no more than x cores?

后端 未结 2 1582
渐次进展
渐次进展 2020-12-01 07:37

We are benchmarking existing Java programs. They are threaded applications designed to benefit from multi-core CPUs. We would like to measure the effect of the number of cor

2条回答
  •  执笔经年
    2020-12-01 08:22

    It's called setting CPU affinity, and it's an OS setting for processes, not specific to Java.

    On Linux: http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html

    On Windows: http://www.addictivetips.com/windows-tips/how-to-set-processor-affinity-to-an-application-in-windows/

    On Mac it doesn't look like you can set it: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-os-x

提交回复
热议问题