Java Multithreading - Assign threads to processor cores

前端 未结 7 1458
[愿得一人]
[愿得一人] 2020-12-18 09:42

I am writing an application in java which involves parallel computing. My question is how can I explicitly assign threads to cores? What is the programming logic for it?

7条回答
  •  悲&欢浪女
    2020-12-18 10:26

    The OS manages what threads are processed on what core. You will need to assign the threads to a single core in the OS.

    For instance. On windows, open task manager, go to the processes tab and right click on the java processes... then assign them to a specific core.

    That is the best you are going to get.

    you can assign thread priority as per your requirement

提交回复
热议问题