News for hackers. Stuff that matters.
Re:Making the Tokio scheduler 10x faster by dunkelheit on Monday October 14, 2019 @02:22PM (#21251221)
What do you mean by coherence? If it is the property that all updates to a single memory location are seen in a consistent order by all threads then Relaxed guarantees that.
Re:Making the Tokio scheduler 10x faster by wilsonthewhale on Monday October 14, 2019 @03:00PM (#21251564)
it doesn't. From cppreference (whose model Rust roughly follows): "Relaxed operation: there are no synchronization or ordering constraints imposed on other reads or writes, only this operation's atomicity is guaranteed"
Re:Making the Tokio scheduler 10x faster by dunkelheit on Monday October 14, 2019 @03:21PM (#21251768)
Still I think I am correct. The docs (https://doc.rust-lang.org/std/sync/atomic/enum.Ordering.html...) point to https://llvm.org/docs/Atomics.html#monotonic which states that "It essentially guarantees that if you take all the operations affecting a specific address, a consistent ordering exists." which is what I've said.
Re:Making the Tokio scheduler 10x faster by ComputerGuru on Monday October 14, 2019 @03:34PM (#21251892)
Yes, a consistent ordering exists but that ordering isn’t necessarily what you think or want it to be. The consistency is present based off the order the reads and writes were executed in; you’ll never read back a value that wasn’t at some point stored there. Which can happen with non-atomic reads/writes, where you’ll read part of one write and part of the next. Reads can still be reordered before writes, as no memory barriers are issued.
Re:Making the Tokio scheduler 10x faster by dunkelheit on Monday October 14, 2019 @04:20PM (#21252418)
Well that doesn't contradict anything that I have said :) My question remains - what do you mean by coherence? I argue that it is precisely the property that there is a consistent order of operations a single memory memory location so you can't say that Relaxed operations don't satisfy coherence.
Re:Making the Tokio scheduler 10x faster by gpderetta on Monday October 14, 2019 @07:02PM (#21253794)
You are correct. IIRC Coherency is the only property of relaxed atomic operations, as opposed of plain load/stores where concurrent modification and access is just UB.