• 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: NSThread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread


  • Subject: Re: NSThread
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 08 Mar 2011 09:22:14 -0800

On Mar 8, 2011, at 12:33 AM, Bruno Causse wrote:

> the performance is not a problem, all my threads are waiting for a answer to a request.

That is potentially still a big problem as every thread uses kernel resources, reserves memory for a stack, and otherwise pollutes the kernel's scheduling information.

A far better approach is to having a single thread that handles all the waiting and then spews off the work to be done to a [reasonably sized] pool of threads.

An even better approach than that would be to use GCD.   Do the waiting threads wait on something that is covered by dispatch sources?  If so, that solution will be significantly cleaner and more efficient than anything you could do using the lower level APIs [since GCD can collude with the kernel].   If not, dispatching the units of work via the GCD APIs will likely be more efficient and generally be simpler than managing a pool of threads.

>
> my program is a kind of working's Distributor.
>

_______________________________________________

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: 
 >NSThread (From: Bruno Causse <email@hidden>)
 >Re: NSThread (From: Bill Bumgarner <email@hidden>)
 >Re: NSThread (From: Bruno Causse <email@hidden>)

  • Prev by Date: Re: How to wait for methods with result/completion blocks to finish?
  • Next by Date: Re: Notifications and Subclassing
  • Previous by thread: Re: NSThread
  • Next by thread: Crash with extra [CFString release] after changing a bound value in NSTextField
  • Index(es):
    • Date
    • Thread