Aligning to cache line and knowing the cache line size

前端 未结 7 1744
盖世英雄少女心
盖世英雄少女心 2020-12-12 10:07

To prevent false sharing, I want to align each element of an array to a cache line. So first I need to know the size of a cache line, so I assign each element that amount of

7条回答
  •  攒了一身酷
    2020-12-12 10:49

    Another simple way is to just cat the /proc/cpuinfo:

    cat /proc/cpuinfo | grep cache_alignment

提交回复
热议问题