Java limiting resource usage

前端 未结 3 786
借酒劲吻你
借酒劲吻你 2021-02-19 04:48

Is there a way to limit both the number of cores that java uses?

And in that same vein, is it possible to limit how much of that core is being used?

3条回答
  •  囚心锁ツ
    2021-02-19 05:32

    You can use taskset on linux. You can also lower the priority of a process, but unless the CPU(S) are busy, a process will get as much CPU as it can use.

    I have a library for dedicating thread to a core, called Java Thread Affinity, but it may have a different purpose to what you have in mind. Can you clarify why you want to do this?

提交回复
热议问题