0

While doing multi-threading programming in C we can assign threads to different cores of a processor and it gives us surety that the threads will be executed in different cores (i.e hyper-threading).But how exactly java does the above task--

  1. Does it assign the threads to a single core and execute it in time-stamp basis or assign to different cores..?
  2. If it assign the above to different cores then how..?
Abimaran Kugathasan
  • 31,165
  • 11
  • 75
  • 105
Bishnu
  • 383
  • 4
  • 14
  • Generally speaking, you don't need to know. Can you say why you want to override what the scheduler does because there is only very specific cases where it helps. – Peter Lawrey Feb 08 '14 at 15:23

1 Answers1

1

By default, Java does not implement any form of Thread affinity. However, because it uses the underlying operating system's threads, it is possible to use native code to set the cpu affinity for a thread. One example of a project that does this is here: https://github.com/peter-lawrey/Java-Thread-Affinity

Jules
  • 14,841
  • 9
  • 83
  • 130