Does Java have support for multicore processors/parallel processing?

前端 未结 5 1775
生来不讨喜
生来不讨喜 2020-11-29 19:10

I know that now that most processors have two or more cores, multicore programming is all the rage. Is there functionality to utilize this in Java? I know that Java has a Th

5条回答
  •  感动是毒
    2020-11-29 19:54

    In most Java implementations, you can rely on Java threads being real OS threads. As a result, the operating system will take care of making sure that the workload is distributed across multiple cores if you use the Thread class.

    Operating system threads pre-date commodity multicore systems by a long time, so that's not a concern really. The only difference multicore systems made was to allow time-multiplexed operating system threads to be executed as truly concurrent threads on multiple cores.

提交回复
热议问题