王璞-Rust大会2023.pdf
1、第三届中国第三届中国Rust开开发发者大会者大会Rust Atomic Deep DivePu Wang DatenLord2023/06/17Rust原子操作高性能实践What are atomic operations in Rust?WhatWhy need atomic operations?WhyHow010203Memory order in atomic operationsMemory ModelThe overhead of atomic operationsCache CoherenceSummary040506How to understand atomic operat
2、ions?Atomic operation best practiceOutlineWhat are Atomic Operations in Rust?fn compare_exchange(&self,/AtomicI8 current:i8,new:i8,success:Ordering,failure:Ordering)-ResultCompare and SwapFetch and Modifyfn fetch_add(&self,val:i8,order:Ordering)-i8fn fetch_and(&self,val:bool,order:Ordering)-bool01Lo
3、ck-free programmingWhy Atomic Operation?High PerformanceLock-context switchAtomic-no context switchShared Variable Access When Multi-threading02How to Understand Atomic Operations?Memory OrderThe order of load/store instructions accessing memory.Memory ModelCache CoherenceAtomic operation overheadAt





点击查看更多