Re: A question about "4.3.4.2 A Volatile Solution" of perfbook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Elad,

Thanks very much for your time and clarification!

Best Regards
Nan Xiao

On Mon, Nov 11, 2024 at 8:05 PM Elad Lahav <e2lahav@xxxxxxxxx> wrote:
>
> > Machine-sized means smaller than or equal to sizeof(long).
> >
> > Take a look at the implementation of WRITE_ONCE or READ_ONCE of linux.
>
> That is not necessarily true. What sizes and alignments are guaranteed
> to be atomic for access (i.e., writing a value to a memory location
> results in everyone seeing either the old value or the new value,
> never a mix) is defined by the hardware architecture, and need not
> align with the C definition of long. You can use the C11
> ATOMIC_*_LOCK_FREE() to determine if a type is atomic.
>
> As Akira points out, the term "atomic" is overloaded, and can cause
> much confusion. A type being atomic for read or write access does not
> imply atomic read-modify-write.
>
> --Elad





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux