简体   繁体   中英

Set Java Multithreading Affinity

I'm using IntelliJ with the ForkJoin framework, 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM