Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.straub-nv.de!uucp.gnuu.de!feed.cnntp.org!news.cnntp.org!not-for-mail From: Anthony Williams Newsgroups: comp.programming.threads Subject: Re: questions about memory_order_seq_cst fence References: <43eb372b-6517-4914-b647-860f1f7136ba@k15g2000pri.googlegroups.com> <87boxyfctc.fsf@justsoftwaresolutions.co.uk> <4DF9D581.E607BEB4@web.de> Date: Thu, 16 Jun 2011 11:19:00 +0100 Message-ID: <8739jaf59n.fsf@justsoftwaresolutions.co.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:F5solXDWLVjFsYCJ/PWna/Q2Rtw= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 34 Organization: CNNTP NNTP-Posting-Host: e778b811.read.cnntp.org X-Trace: DXC=A0ZU78;o`KioG4=<6_54TbWoT\PAgXa?a=oT3jZUB0ei31?8ZVJ3gMeGj6PdB418Wn:ck<1Q=Rn1lRR1mF<=JZoh X-Complaints-To: abuse@cnntp.org Xref: x330-a1.tempe.blueboxinc.net comp.programming.threads:291 Alexander Terekhov writes: > Anthony Williams wrote: >> >> Edek writes: >> >> > As a side note, I compiled all ops on x86_64, and atomic::load >> > is mfence/load/mfence even for relaxed. I'd need some time to analyse >> > the thing from perspective of other ops implementations in all >> > orderings, and this leads me to the not so subtle question: >> >> Ouch. That is a seriously over-cautious implementation. Atomics should >> not need any fences on x86_64 unless you actually write >> atomic_thread_fence(memory_order_seq_cst) >> >> See my blog entry for the required operations: >> >> http://www.justsoftwaresolutions.co.uk/threading/intel-memory-ordering-and-c++-memory-model.html >> >> The only one that is not a plain MOV is a seq_cst store, which is an >> XCHG. > > I believe that a seq_cst load is not a plain move either... Why do think it shouldn't be, and what do you think it should be instead? The mapping in my blog post was confirmed by Intel processor engineers. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976