Would a multithreaded Java application exploit a multi-core machine very well?

后端 未结 4 1846
慢半拍i
慢半拍i 2020-12-18 14:11

If I write a multi-threaded java application, will the JVM take care of utilizing all available cores? Do I have to do some work?

4条回答
  •  孤城傲影
    2020-12-18 14:42

    All modern JVMs will take advantage of as many cores as your hardware has. An easy way to illustrate this is to download and run the DaCapo benchmark on your machine. The lusearch benchmark uses 32 threads. If you run this on your desktop or server, you should see all of your CPUs hit 100% utilization during the test.

提交回复
热议问题