Memory Model

本文深入探讨了内存模型的三个方面:原子性、可见性和顺序,并对比了CPU内存模型和语言内存模型之间的差异。从硬件层面的内存屏障到Java和C++的标准,内容涵盖并发编程中的锁-free实现、相关书籍推荐以及有价值的博客资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 Preliminary

  • Computer Architecture A Quantitative Approach, 5th Edition()

2 Memory Model

2.1 Three Aspects

Atomicity

Visibility

Ordering

2.2 General Model(Weaker)

  1. The hardware threads can each perform reads and writes out-of-order, oreven speculatively (before preceding conditional branches have been resolved). In contrast to TSO, where there is no local reordering except of reads after writes to different addresses, here any local reordering is allowed unless specified otherwise.
  2. The memory system (perhaps involving a hierarchy of buffers and a complex interconnect) does not guarantee that a write becomes visible to all other hardware threads at the same time point; these architectures are not multiple-copy atomic.

3 Two aspects

3.1 CPU Memory Model

3.1.1 Implementation

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值