2

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?

Jana Mandic
  • 115
  • 6
  • possible duplicate of [Java thread affinity](http://stackoverflow.com/questions/2238272/java-thread-affinity) – ratchet freak Aug 14 '11 at 00:29
  • Well even if your code itself is purely sequential do you really want to artificially limit the necessary background threads of the JVM (mostly for GC, but also finalizers, etc.) to only one thread? I don't really see the use in that. Why not conventionally just time how long it takes to execute task X? – Voo Aug 14 '11 at 01:27

1 Answers1

0

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

ratchet freak
  • 47,288
  • 5
  • 68
  • 106