Degrading performance when increasing number of cores

前端 未结 3 1028
别那么骄傲
别那么骄傲 2021-02-07 20:36

My mac is armed with 16 cores.

System.out.println(Runtime.getRuntime().availableProcessors());  //16

I\'m running the code below to see the eff

3条回答
  •  离开以前
    2021-02-07 20:54

    Adding processors causes all sorts of problems, but mostly they have to do with synchronization between processors. Task-level locking within the file system, etc, can become a problem, but even more of a problem is the synchronization between cores that must occur just to maintain cache coherence, keep track of changed pages, etc. I don't know how many cores per chip you have (gave up tracking that stuff about 10 years ago), but generally once you begin synchronizing off-chip performance goes down the tubes.

    I'll add that the JVM can make a major difference here. Careful JVM design is required to minimize the number of shared (and frequently updated) cache lines, and incredible effort is required to make GC work efficiently in a multi-core environment.

提交回复
热议问题