14

The Apple docs say that if you set the maxConcurrentOperationCount property of an NSOperationQueue to NSOperationQueueDefaultMaxConcurrentOperationCount (the default) then it will adjust the value at run time based on "system conditions".

If you specify the value NSOperationQueueDefaultMaxConcurrentOperationCount (which is recommended), the maximum number of operations can change dynamically based on system conditions.

Can anyone report what they are seeing that value being set to in the wild on different devices? Are we talking 1 or 2 for old phones and 3-4 for new models, or 10 or ?? It does not give any insight into the possibility set or most common result. I think it would be useful for developers to know what to expect to happen in production, rather than just we'll take care of it without any explanation of what they are optimizing for (UI responsiveness, operation execution speed, etc).

Joel
  • 15,654
  • 5
  • 37
  • 60

1 Answers1

6

As it said in many different variations and resources (for instance), you never know how many threads you should create for your application's workflow.

It's a matter of CPU time and load how much threads your application needs (because it's not alone in the woods). So, answer is:

  1. optimization for number of cores
  2. optimization for CPU architecture
  3. optimization for current CPU load
art-divin
  • 1,635
  • 1
  • 20
  • 28
  • 1
    NSOperationQueueDefaultMaxConcurrentOperationCount some times allows queue to create as many threads as it becomes difficult for iOS app to manage them. I am getting SIGABRT due to number of threads running while using NSOperationQueueDefaultMaxConcurrentOperationCount.NO idea why so many operation are being created. – dev gr Oct 23 '13 at 12:18
  • @devgr try to set breakpoints and good luck in debugging. You can search for relative questions, or ask for help in a new one just for your needs. – art-divin Oct 24 '13 at 15:15