Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Blakeasd

macrumors 6502a
Original poster
Dec 29, 2009
643
0
Is a queue equivalent to a processor core? If it is what happens if you create and use more cores than the user has, can you detect the number of cores a user has in GDC?
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
A queue is not equal to a processor core.

The purpose of GCD is map queues to cores appropriately. Appropriately means not just the number of cores, but also taking into consideration total system workload.

Just create queues as needed and let GCD do the management. Having more queues than cores is the same as having more processes than CPUs, the operating system will manage it for you.

Don't be naive, though. Do create sequential and parallel queue intelligently for the tasks at hand. But the decision should be based around the nature of the tasks, not the user's environment.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
Is a queue equivalent to a processor core? If it is what happens if you create and use more cores than the user has, can you detect the number of cores a user has in GDC?

_One_ asynchronous queue will use the exact right number of cores as needed for all tasks in the queue. How many cores depends on what other queues both in your application and in all other application are using; the OS will decide to optimise performance for everyone. Do _not_ create more queues in an attempt to use more cores, it doesn't work that way.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,565
What exactly is a queue then?

An object responsible for executing blocks on multiple cores.

Apple spent probably lots of money for the salary of a technical writer documenting how dispatch queues work. You should make use of that money and read the documentation. If there is something you don't understand, post it here.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.