Java - multithreaded code does not run faster on more cores

后端 未结 5 1651
半阙折子戏
半阙折子戏 2021-02-10 22:59

I was just running some multithreaded code on a 4-core machine in the hopes that it would be faster than on a single-core machine. Here\'s the idea: I got a fixed number of thre

5条回答
  •  青春惊慌失措
    2021-02-10 23:09

    synchronizing across cores is much slower than syncing on a single core

    because on a single cored machine the JVM doesn't flush the cache (a very slow operation) during each sync

    check out this blog post

提交回复
热议问题