V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
aheadlead
V2EX  ›  问与答

在需要高性能的编程中,需要注意多核 CPU 的缓存一致性 MESI 协议吗?

  •  
  •   aheadlead · Sep 28, 2017 · 2670 views
    This topic created in 3133 days ago, the information mentioned may be changed or developed.
    6 replies    2017-09-28 19:41:58 +08:00
    ipconfiger
        1
    ipconfiger  
       Sep 28, 2017
    需要
    aheadlead
        2
    aheadlead  
    OP
       Sep 28, 2017
    @ipconfiger 愿闻其详
    希望能给出一些参考资料,或者类似游戏引擎的代码参考,谢谢
    clearbug
        3
    clearbug  
       Sep 28, 2017 via Android
    这个东西不是都会在编程语言层面处理的么?我看 java 好像是这样的!楼主说的编程是用什么语言?
    gogohigh
        4
    gogohigh  
       Sep 28, 2017   ❤️ 1
    Java 有 JMM 处理
    xxzs
        5
    xxzs  
       Sep 28, 2017   ❤️ 1
    可以看看 folly, 比如 ProducerConsumer Queue 里面就对 cache line 做了特别处理,
    char pad0_[CacheLocality::kFalseSharingRange];
    const uint32_t size_;
    T* const records_;

    FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic<unsigned int> readIndex_;
    FOLLY_ALIGN_TO_AVOID_FALSE_SHARING std::atomic<unsigned int> writeIndex_;

    char pad1_[CacheLocality::kFalseSharingRange - sizeof(writeIndex_)];
    };
    xxzs
        6
    xxzs  
       Sep 28, 2017   ❤️ 1
    有兴趣还可以研究一下 C++的 std::memory_order
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2993 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:17 · PVG 23:17 · LAX 08:17 · JFK 11:17
    ♥ Do have faith in what you're doing.