tech-userlevel archive

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

Re: pthread library related

On Tue, May 31, 2016 at 04:49:00AM +0200, Steffen Nurpmeso wrote:
> Joerg Sonnenberger <> wrote:
>  |On Mon, May 30, 2016 at 02:19:26PM -0700, Charles Cui wrote:
>  |> good to know atomic_inc_uint_nv is implemented using cas.
>  |
>  |No, atomic_inc is *not* necessarily implemented using CAS. There are a
> What a pity.

Not at all.

Read it again: (a) the application [or kernel code] should not care about
the implementation details and (b) it MAY be implemented differently - the
decision is up to the architecture and depends on various things. As Jörg
said, sometimes the implementation will be different depending on the number
of processors or exact cpu (sub-)version found.

On some architectures (like m68k, where we do not even support SMP) it will
be a simple pre-increment/decrement instruction, no overhead at all.


Home | Main Index | Thread Index | Old Index