On Thu, 9 Apr 2015 14:40:16 -0500, Ken Thomases said: >If some of your tasks are blocked (due to I/O or locks or even sleeps), >then you may have more tasks in flight than there are cores, because the >blocked tasks don't consume CPU capacity. This can actually be a >problem if you have tasks which are mixed I/O and computation, because >GCD will over-subscribe the CPU. When the tasks unblock, there are more >tasks wanting CPU than there are cores. > >As much as possible, use dispatch I/O or dispatch sources for I/O. Keep >tasks segregated to doing either I/O or computation, not a mix. If you >can't use dispatch I/O or sources, then try to self-limit the number of >I/O tasks in flight at once (for example by submitting them to a serial >queue or low-concurrency-limit NSOperationQueue per device). Once you >do that, you should be safe to submit large numbers of CPU tasks and let >GCD manage them.
Not just IO, but memory usage too. If you have 24 cores, and GCD spins up 24 simultaneous 'tasks', and each needs 2 GB of RAM, then you better hope you have 48 GB of RAM too, or you'll swap and easily end up dog slow. Cheers, -- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com