• 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: Newbie query re multithreading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie query re multithreading


  • Subject: Re: Newbie query re multithreading
  • From: Greg Parker <email@hidden>
  • Date: Tue, 18 Aug 2009 17:54:21 -0700

On Aug 18, 2009, at 7:25 AM, McLaughlin, Michael P. wrote:
1) With 1 CPU (NSOperation not used), I get 50% of CPU-time devoted to
auto_collection_thread which I presume means Garbage Collection. Is this
normal? It seems excessive.


2) With 2 CPUs, I get 26% of CPU-time for auto_collection_thread and another
26% for mach_msg_trap --> CFRunLoopSpecific (apparently back to Carbon
again).

You may be reading the sampling results incorrectly. That 50% in auto_collection_thread and 26% in CFRunLoopRunSpecific are almost certainly time that those threads are waiting for something else to happen. The garbage collector is waiting for memory usage to go too high, and CFRunLoopRunSpecific is waiting for a user event or timer or I/O to arrive. These are normal - the GC thread and event loop spend most of their wall-clock time doing nothing in most programs.


The sampling tools grab stack traces every n milliseconds. A thread that is stopped waiting for something else to happen will show up in lots of those stack traces even though it's not using any CPU time. If the samples always hit in exactly the same place, it's likely that the thread is in fact doing nothing.


-- Greg Parker email@hidden Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Newbie query re multithreading (From: "McLaughlin, Michael P." <email@hidden>)

  • Prev by Date: Re: Coding with VM limitation on the iPhone?
  • Next by Date: NSTableView empty selection not working
  • Previous by thread: Re: Newbie query re multithreading
  • Next by thread: Re: Newbie query re multithreading
  • Index(es):
    • Date
    • Thread