Re: Silly ARC question - explanation requested
Re: Silly ARC question - explanation requested
- Subject: Re: Silly ARC question - explanation requested
- From: Quincey Morris <email@hidden>
- Date: Wed, 04 Jun 2014 15:02:46 -0700
On Jun 4, 2014, at 14:45 , Alex Zavatone <email@hidden> wrote:
> But I need to come up with an explanation of explain why that is a bad idea and why it smells
It smells because a computationally intensive while loop will stall the dispatch queue that’s stuck on it.
If you’re programming with *threads*, it’s fine to dedicate a thread to a long-running operation.
If you’re programming with *dispatch queues*, you’re sharing a resource (a CPU) with other applications. Taking the resource over for yourself is detrimental to overall system performance.
Breaking the long task into smaller pieces allows the pieces to be distributed over as many threads as the OS wants to use, and doesn’t deny access to CPUs to other threads and processes.
_______________________________________________
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