Re: Volatile semantic for failed/noop atomic operations

2019-09-14 Thread Simone Bordet
Hi, On Sat, Sep 14, 2019 at 8:28 PM Vitaly Davidovich wrote: > > Unlike C++, where you can specify mem ordering for failure and success > separately, Java doesn’t allow that. But, the mem ordering is the same for > failure/success there. Unfortunately it doesn’t look like the javadocs >

Re: Volatile semantic for failed/noop atomic operations

2019-09-14 Thread Vitaly Davidovich
On x86, I’ve never heard of failed CAS being cheaper. In theory, cache snooping can inform the core whether it’s xchg would succeed without going through the RFO dance. But, to perform the actual xchg it would need ownership regardless (if not already owned/exclusive). Sharing ordinary mutable

Re: Volatile semantic for failed/noop atomic operations

2019-09-14 Thread Francesco Nigro
Although not mentioned (neither on Doug's cookbook) I have always supposed was more likely the c++ default for both weak/strong CAS ie seq_cst memory ordering. To make this question more mechanical sympathy focused: on hardware level what happen? I would be curious to know both x86/arm versions