How do I force two Java threads to run on the same processor / core?

I want a solution that does not include critical parts or similar synchronization alternatives I'm looking for something similar to windows optical fiber (user thread)

Solution

The operating system manages which threads are processed on which core You need to assign threads to a single core in the OS

For example On windows, open the task manager, go to the Processes tab and right-click Java processes... And assign them to a specific core

This is the best you will get

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>