[OT] Re: Problem on dual-processor Macs
[OT] Re: Problem on dual-processor Macs
- Subject: [OT] Re: Problem on dual-processor Macs
- From: "Alastair J.Houghton" <email@hidden>
- Date: Thu, 25 Sep 2003 12:38:38 +0100
On Thursday, September 25, 2003, at 10:47 am, Tim Hewett wrote:
These indexes are C 'int' data types, so are signed 32-bit
integers at the CPU instruction level. I would expect that
incrementing a 32-bit integer to be an atomic operation,
Then that may well be your problem. Incrementing a 32-bit integer is
not an atomic operation because it involves a read, an increment and a
write, which are three separate instructions on a PowerPC chip (as on
most other RISC architectures). Having said that, I was under the
impression that your code only wrote to each variable from a single
thread, so I'm not certain why the non-atomicity of increment is
actually relevant. One possibility, I suppose, is that "in" and "out"
aren't aligned on 32-bit boundaries, as the PowerPC architecture
doesn't guarantee atomicity of reads or writes in that case.
BTW, this post is off-topic for the Cocoa-dev list; Omni Group's
macosx-dev and the PowerPC newsgroups would have been better places to
ask. If you want to reply to this message, please do so off-list.
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.