Set Java Multithreading Affinity
I'm using IntelliJ with the ForkJoin framew开发者_运维知识库ork, and am trying to benchmark two versions of my code. One is using forkjoin, one is sequential. Unfortunately, it seems that the JDK/Windows auto-distribute the sequential one across 4 cores to a certain extent. Is there a way to give a compiler directive to force affinity to only one core for the sequential version?
in windows you can use the task manager for this find the java.exe process and right-click (you'll need to reset this each time you restart it)
or you'll need to make native calls to set the affinity
精彩评论