Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

64 bit atomic reads on x86

0 views
Skip to first unread message

A. N. O. N.

unread,
Nov 23, 2009, 5:48:32 PM11/23/09
to
Hi there,

Is it safe to assume that split 32-bit reads of a 64-bit value will be
consistent if the 64-bit value is only written to with a lock
cmpxchg8b?

For other cases, is movq the only way to go?

Thanks!

Richard Tobin

unread,
Nov 23, 2009, 6:03:46 PM11/23/09
to
In article <hef3g0$mra$1...@aioe.org>, A. N. O. N. <nos...@nospam.com> wrote:
>Is it safe to assume that split 32-bit reads of a 64-bit value will be
>consistent if the 64-bit value is only written to with a lock
>cmpxchg8b?

Remember not to feed the troll!

-- Richard
--
Please remember to mention me / in tapes you leave behind.

Keith Thompson

unread,
Nov 23, 2009, 6:07:27 PM11/23/09
to
ric...@cogsci.ed.ac.uk (Richard Tobin) writes:
> In article <hef3g0$mra$1...@aioe.org>, A. N. O. N. <nos...@nospam.com> wrote:
>>Is it safe to assume that split 32-bit reads of a 64-bit value will be
>>consistent if the 64-bit value is only written to with a lock
>>cmpxchg8b?
>
> Remember not to feed the troll!

I haven't seen any posts from "A. N. O. N." before. Is this a known
troll, or are you assuming it based on a single post?

--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Richard

unread,
Nov 23, 2009, 6:17:04 PM11/23/09
to
ric...@cogsci.ed.ac.uk (Richard Tobin) writes:

> In article <hef3g0$mra$1...@aioe.org>, A. N. O. N. <nos...@nospam.com> wrote:
>>Is it safe to assume that split 32-bit reads of a 64-bit value will be
>>consistent if the 64-bit value is only written to with a lock
>>cmpxchg8b?
>
> Remember not to feed the troll!
>
> -- Richard

When accusing other of trolling it would be considerate if you learnt
how to correctly set a signature so replies will correctly snip
them. The standard is two dashes followed by a space then newline as
below :-

--
"Avoid hyperbole at all costs, its the most destructive argument on
the planet" - Mark McIntyre in comp.lang.c

Richard Tobin

unread,
Nov 23, 2009, 6:44:58 PM11/23/09
to
In article <lnaayca...@nuthaus.mib.org>,

Keith Thompson <ks...@mib.org> wrote:
>I haven't seen any posts from "A. N. O. N." before. Is this a known
>troll, or are you assuming it based on a single post?

A poster calling themselves "A.N.O.N" anonymously posting such a
classically off-topic article? What are the chances of them *not*
being a troll? Why would anyone who really wanted the answer to that
question post under such a name? And it's unlikely enough that anyone
with the technical knowledge shown by the question would make the
mistake of thinking that comp.lang.c was appropriate, quite apart from
the name.

I suspect that the poster - who is presumably one of the regulars -
will be congratulating himself on eliciting such an example of
pedantry from you!

Keith Thompson

unread,
Nov 23, 2009, 7:15:16 PM11/23/09
to
ric...@cogsci.ed.ac.uk (Richard Tobin) writes:
> In article <lnaayca...@nuthaus.mib.org>,
> Keith Thompson <ks...@mib.org> wrote:
>>I haven't seen any posts from "A. N. O. N." before. Is this a known
>>troll, or are you assuming it based on a single post?
>
> A poster calling themselves "A.N.O.N" anonymously posting such a
> classically off-topic article? What are the chances of them *not*
> being a troll? Why would anyone who really wanted the answer to that
> question post under such a name? And it's unlikely enough that anyone
> with the technical knowledge shown by the question would make the
> mistake of thinking that comp.lang.c was appropriate, quite apart from
> the name.

So you're assuming based on a single post.

> I suspect that the poster - who is presumably one of the regulars -
> will be congratulating himself on eliciting such an example of
> pedantry from you!

I hope that by "regulars" you mean the regular trolls. I wouldn't
make that assumption (there's no shortage of trolls, unfortunately,
and this one could easily be a lurker who decided to be obnoxious),
but it doesn't really matter.

Pedantry? I was just asking you a simple question. Sheesh.

Richard

unread,
Nov 23, 2009, 7:20:20 PM11/23/09
to
Keith Thompson <ks...@mib.org> writes:

> ric...@cogsci.ed.ac.uk (Richard Tobin) writes:
>> In article <lnaayca...@nuthaus.mib.org>,
>> Keith Thompson <ks...@mib.org> wrote:
>>>I haven't seen any posts from "A. N. O. N." before. Is this a known
>>>troll, or are you assuming it based on a single post?
>>
>> A poster calling themselves "A.N.O.N" anonymously posting such a
>> classically off-topic article? What are the chances of them *not*
>> being a troll? Why would anyone who really wanted the answer to that
>> question post under such a name? And it's unlikely enough that anyone
>> with the technical knowledge shown by the question would make the
>> mistake of thinking that comp.lang.c was appropriate, quite apart from
>> the name.
>
> So you're assuming based on a single post.
>
>> I suspect that the poster - who is presumably one of the regulars -
>> will be congratulating himself on eliciting such an example of
>> pedantry from you!
>
> I hope that by "regulars" you mean the regular trolls. I wouldn't
> make that assumption (there's no shortage of trolls, unfortunately,
> and this one could easily be a lurker who decided to be obnoxious),
> but it doesn't really matter.
>
> Pedantry? I was just asking you a simple question. Sheesh.

I congratulate you Keith. Another cold, sterile analysis from you and
the "Troll" is laughing himself to death. This thread is rapidly
becoming more that the original poster could ever have
hoped. Seriously, are YOU trolling here?

Message has been deleted

Ben Bacarisse

unread,
Nov 23, 2009, 8:55:53 PM11/23/09
to
Beej Jorgensen <be...@beej.us> writes:

> A. N. O. N. <nos...@nospam.com> wrote:

>>Is it safe to assume that split 32-bit reads of a 64-bit value will be
>>consistent if the 64-bit value is only written to with a lock
>>cmpxchg8b?
>

> If you don't get an answer here, try an x86 forum.

...or the OP can read the tread in comp.programming.threads where
someone else (presumably) posted exactly the same text (word for
word) over three and half years ago.

--
Ben.

Beej Jorgensen

unread,
Nov 23, 2009, 10:55:38 PM11/23/09
to
Ben Bacarisse <ben.u...@bsb.me.uk> wrote:
>...or the OP can read the tread in comp.programming.threads where
>someone else (presumably) posted exactly the same text (word for
>word) over three and half years ago.

Ah, so they can:

http://groups.google.com/group/comp.programming.threads/browse_frm/thread/4ca6b68211a035d0/166c80e38cc4f561

http://tinyurl.com/yja93wz

-Beej

Michael Foukarakis

unread,
Nov 24, 2009, 8:16:16 AM11/24/09
to
On Nov 24, 12:48 am, "A. N. O. N." <nos...@nospam.com> wrote:
> Hi there,
>
> Is it safe to assume that split 32-bit reads of a 64-bit value will be
> consistent if the 64-bit value is only written to with a lock
> cmpxchg8b?
>
No.

> For other cases, is movq the only way to go?
>

Only if said quadword is aligned on a 64-bit boundary. A more general
solution would use the fild/fist instructions.

Also, you might receive more information on comp.lang.asm.x86, it's
well suited to your question.

Cheers.

BGB / cr88192

unread,
Nov 24, 2009, 10:49:53 PM11/24/09
to

"Richard Tobin" <ric...@cogsci.ed.ac.uk> wrote in message
news:hef6pq$24sr$1...@pc-news.cogsci.ed.ac.uk...

> In article <lnaayca...@nuthaus.mib.org>,
> Keith Thompson <ks...@mib.org> wrote:
>>I haven't seen any posts from "A. N. O. N." before. Is this a known
>>troll, or are you assuming it based on a single post?
>
> A poster calling themselves "A.N.O.N" anonymously posting such a
> classically off-topic article? What are the chances of them *not*
> being a troll? Why would anyone who really wanted the answer to that
> question post under such a name? And it's unlikely enough that anyone
> with the technical knowledge shown by the question would make the
> mistake of thinking that comp.lang.c was appropriate, quite apart from
> the name.
>

maybe...

maybe it is an act of 'anonymous', as evidenced by a news report:
http://www.youtube.com/watch?v=DNO6G4ApJQY

(and, yes, you really can buy a dog to protect from the people on 4chan,
which is, in fact, a secret hideout for hackers...).


they came anonymously apparently from 'aioe.org'.


> I suspect that the poster - who is presumably one of the regulars -
> will be congratulating himself on eliciting such an example of
> pedantry from you!
>

indeed...

but, to sneak this post in here, he probably has an invisible hand...
then his other friend is all like "where is your other hand?..."

a quick diversion is then made by pulling a rabbit out of a hat.

Phil Carmody

unread,
Nov 25, 2009, 7:16:30 PM11/25/09
to
ric...@cogsci.ed.ac.uk (Richard Tobin) writes:
> In article <hef3g0$mra$1...@aioe.org>, A. N. O. N. <nos...@nospam.com> wrote:
>>Is it safe to assume that split 32-bit reads of a 64-bit value will be
>>consistent if the 64-bit value is only written to with a lock
>>cmpxchg8b?
>
> Remember not to feed the troll!

8, by the looks of it. Not the best troll ever, but an 8:1 ratio's
probably high enough for him to do it again.

Phil
--
Any true emperor never needs to wear clothes. -- Devany on r.a.s.f1

0 new messages