Re: Beachballing 2
Re: Beachballing 2
- Subject: Re: Beachballing 2
- From: Alex Zavatone <email@hidden>
- Date: Tue, 04 Dec 2012 13:19:42 -0500
WAG - the # of cores - 1?
On Dec 4, 2012, at 12:54 PM, Gerriet M. Denkmann wrote:
> My app creates lots of MyOperations (subclass of NSOperation) and puts them into an NSOperationQueue.
> These operations do not do any I/O - they just use the Cpu.
>
> When I make some other app active and then try again to make my app active, my app beach-balls. When all my operations have finished, the app becomes responsive again.
>
> This seems to be a known problem: <http://stackoverflow.com/questions/13148684/deadlock-using-dispatch-semaphore-t-in-a-concurrent-queue>
>
> I used to do:
> [ self.operationQueue setMaxConcurrentOperationCount: NSOperationQueueDefaultMaxConcurrentOperationCount ];
>
> because I wanted "the receiver to choose an appropriate value based on the number of available processors and other relevant factors."
>
> But, the receiver obviously chooses a value, which is NOT appropriate at all.
>
> When I change this to:
> [ self.operationQueue setMaxConcurrentOperationCount: 7 ];
> my app runs 3% slower (not 14% slower as I expected) and the beach-ball problem disappears.
>
> The problem: 7 is the right magic number on my machine with my number of processor cores etc.
> But certainly on other machines the number will be different.
>
> So: How do I choose an appropriate number?
> And is this a bug (NSOperationQueue choosing an inappropriate number) or not?
>
> Gerriet.
>
> P.S. Big thanks to Jonathan for his very valuable help off-list.
>
>
> _______________________________________________
>
> 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
_______________________________________________
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: | |
| >Beachballing 2 (From: "Gerriet M. Denkmann" <email@hidden>) |