John Doe
John Doe
use align as less from https://en.cppreference.com/w/cpp/atomic/atomic_ref ``` struct Counters { int a; int b; }; // user-defined trivially-copyable type alignas(std::atomic_ref::required_alignment) Counters counter; std::atomic_ref cnt(counter); // specialization for the user-defined type...
but align by cacheline will be better like from https://github.com/tokio-rs/tokio/blob/master/tokio/src/util/cacheline.rs and align for atomic too
boost has align for all fields i dont known why rust doest align https://www.boost.org/doc/libs/1_63_0/boost/fiber/detail/context_mpsc_queue.hpp
so strange tokio improve mpsc align for tokio channel but not for internal queue https://github.com/tokio-rs/tokio/issues/5830
original work streal spmc from go https://github.com/golang/go/blob/4ed358b57efdad9ed710be7f4fc51495a7620ce2/src/runtime/runtime2.go#L668 does not use align but i dont known how align work for go but my opinion align must be present article https://alic.dev/blog/false-sharing
so you can close issues in my own implementation i will use cache align for indexs and buffer
iam look inside many implementation of spmc queue some implementation has align, some not may be it has sense, spmc queue in work steal case, most single produce/single consume queue...
tail_ index can change to atomic and all drect access to "relaxed" model atomic_ref remove this because golang has no memory model like C++ and has no "relaxed" memory model...
block can be too long width or too long height i want default zoom basic block to allow read chars inside the basic block
compiler can emit nop/s to align the block as you can see the picture there no interests to both blocks if sums of instructions whithout nop the same for it...