• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem on dual-processor Macs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem on dual-processor Macs


  • Subject: Re: Problem on dual-processor Macs
  • From: Kaelin Colclasure <email@hidden>
  • Date: Thu, 25 Sep 2003 06:27:11 -0700

On Thursday, September 25, 2003, at 02: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,

... And you would be mistaken. :-) While the PPC ISA no doubt has an
operation (or sequence of operations) that accomplishes an "atomic
increment", your C compiler is not going to generate code for ++i (or
any variation thereof) that uses it.

If you need this code to be portable, you're going to be stuck with
using OS-level interprocess synchronization support of one kind or
another (and as a consequence you're going to see a substantial
performance cost).

If easy portability can take a back seat to performance, then you can
use gcc's inline assembler to write functions which will use the
correct PPC instruction(s) to accomplish this task. Or better still,
use Google to sleuth out one of the scores of implementations that no
doubt are floating around out there in various open source projects.
Here is a search hit to get you started:
http://archives.postgresql.org/pgsql-bugs/1997-10/msg00020.php

Additional hint: This operation is generically classified as a "test
and set" instruction (just in case you need to do more Googling).

HTH,

-- Kaelin
_______________________________________________
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.

  • Follow-Ups:
    • Re: Problem on dual-processor Macs
      • From: Wade Tregaskis <email@hidden>
References: 
 >Problem on dual-processor Macs (From: Tim Hewett <email@hidden>)

  • Prev by Date: Re: Is Cocoa+Java considered relevant to the list?
  • Next by Date: size of the gray bar at the top of an NSWindow
  • Previous by thread: [OT] Re: Problem on dual-processor Macs
  • Next by thread: Re: Problem on dual-processor Macs
  • Index(es):
    • Date
    • Thread