Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!209.197.12.242.MISMATCH!nx01.iad01.newshosting.com!newshosting.com!news2.euro.net!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Alexander Terekhov Newsgroups: comp.programming.threads Subject: Re: questions about memory_order_seq_cst fence Date: Thu, 16 Jun 2011 12:03:23 +0200 Organization: A noiseless patient Spider Lines: 30 Message-ID: <4DF9D4EB.81CDF399@web.de> References: <43eb372b-6517-4914-b647-860f1f7136ba@k15g2000pri.googlegroups.com> Reply-To: terekhov@web.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="MCbSEzW5qwGLFMNXJh39IQ"; logging-data="24206"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2eMmfi4FrTAXFgqryIXt8s/ljkAlpCVg=" X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en Cancel-Lock: sha1:+4ZxgNNmU0uLfObkfw3p2FVtzG0= Xref: x330-a1.tempe.blueboxinc.net comp.programming.threads:289 Edek wrote: [...] > 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: > > I understand people _should definitely_ use the default. > I assume the goal, or the official word for it is 'rationale', was > to let people 'who understand' write code that would be both portable > and more efficient than the default. I am somehow beginning to doubt > both my capabilities and whether this will be at all possible - I mean > the efficiency, not portability (the latter can be simply done right). > Though maybe the bottom line is that at least the precise implementation > will have at least a couple of fences less than the default, at the > price of - I think no one argues about that - complexity. Try http://www.decadent.org.uk/pipermail/cpp-threads/2008-December/001933.html (Brief tentative example x86 Implementation for C/C++ Memory Model) and http://portal.acm.org/citation.cfm?id=1926394 (Mathematizing C++ concurrency) regards, alexander.