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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to