[concurrency-interest] CompareAndSet - can there also be NO winner?

√iktor Ҡlang viktor.klang at gmail.com
Tue Nov 22 11:33:57 EST 2011


On Tue, Nov 22, 2011 at 5:28 PM, Nathan Reynolds <nathan.reynolds at oracle.com
> wrote:

>  It depends upon the processor.  On x86, there will always be a clear
> winner because forward progress is guaranteed.  On other processors, it
> depends if it guarantees forward progress.
>

It also heavily depends on the current value ;-)


>
> Nathan Reynolds<http://psr.us.oracle.com/wiki/index.php/User:Nathan_Reynolds>| Consulting Member of Technical Staff |
> 602.333.9091
> Oracle PSR Engineering <http://psr.us.oracle.com/> | Server Technology
>
> On 11/22/2011 9:09 AM, Dr Heinz M. Kabutz wrote:
>
> Something I've wondered about for a while...
>
> If we have an atomic integer (or any other atomic class) and two threads
> call compareAndSet(42, 43) at the same time, is it possible that both calls
> fail?  Or is there *always* a winner?
>
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> IEEE Certified Software Development Professionalhttp://www.javaspecialists.eu
> Tel: +30 69 72 850 460
> Skype: kabutz
>
>
>
> _______________________________________________
> Concurrency-interest mailing listConcurrency-interest at cs.oswego.eduhttp://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>


-- 
Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - Enterprise-Grade Scala from the
Experts

Twitter: @viktorklang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20111122/15e8e4f8/attachment.html>


More information about the Concurrency-interest mailing list