Is there a way in Java to find out how many CPUs (or cores) are installed?

前端 未结 5 1399
离开以前
离开以前 2021-02-14 00:46

I want to make some tuning for multithreaded program.

If I know how much threads can really work in parallel I can make the program much more effective.

Is there

5条回答
  •  无人共我
    2021-02-14 01:39

    Yes on windows for sure. JNA with kernel32.dll. Use SYSTEM_INFO structure from GetNativeSystemInfo call. There is dwNumberOfProcessors among other things.

    I believe this will provide the actual number of processors installed, not the number available.

提交回复
热议问题