-1

I want to know how many CPU cores are free to schedule and load balance my activity.is there any provision in java?

  • 3
    To my knowledge, there is no such thing. And you know: even the term "free" would be **hard** to define. – GhostCat Jul 28 '16 at 04:13
  • No such thing, really. Allocate a number of threads calibrated to the number of processors and trust the OS to schedule them sanely. – Louis Wasserman Jul 28 '16 at 04:16

1 Answers1

0

I can not imagine a scenario where you would need to know this, since Threads don't care about this, but if you just want to know how many cores are in the machine you could use

`Runtime.getRuntime().availableProcessors()`

I found out about this from Finding Number of Cores in Java If you want to know the load on the cpu, look at How to monitor the computer's cpu, memory, and disk usage in Java?

Community
  • 1
  • 1
Funny Geeks
  • 483
  • 5
  • 12