Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 1, 2011, 09:15 PM   #1
Blakeasd
macrumors 6502a
 
Join Date: Dec 2009
Queues in Grand Dispatch Central

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?
Blakeasd is offline   0 Reply With Quote
Old Jun 1, 2011, 09:21 PM   #2
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: 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.
jiminaus is offline   0 Reply With Quote
Old Jun 2, 2011, 01:08 AM   #3
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by Blakeasd View Post
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 is offline   0 Reply With Quote
Old Jun 2, 2011, 03:45 PM   #4
Blakeasd
Thread Starter
macrumors 6502a
 
Join Date: Dec 2009
What exactly is a queue then?
Blakeasd is offline   0 Reply With Quote
Old Jun 2, 2011, 04:09 PM   #5
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by Blakeasd View Post
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.
gnasher729 is offline   0 Reply With Quote
Old Jun 2, 2011, 05:37 PM   #6
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
The Concurrent Programming Guide is another good overview. It also talks about the higher-level NSOperationQueue, which was reimplemented on top of GCD in Mac OS X 10.6.
jiminaus is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Apple Officially in Discussions for Retail Store Space in Grand Central Terminal MacRumors MacRumors.com News Discussion 19 May 27, 2011 07:44 AM
iphone queue in Brisbane CBD sud iPhone 5 Jul 10, 2008 07:46 AM
Fans queue in Asia 2 days before new iPhone launch MacBytes MacBytes.com News Discussion 2 Jul 9, 2008 08:31 AM
Queue in HB DJAKO Apple TV and Home Theater 6 Feb 5, 2008 06:25 PM


All times are GMT -5. The time now is 06:14 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC