Re: Background Applications vs Threading
Re: Background Applications vs Threading
- Subject: Re: Background Applications vs Threading
- From: Fritz Anderson <email@hidden>
- Date: Sun, 17 Apr 2011 13:28:59 -0500
On 17 Apr 2011, at 12:04 PM, Bing Li wrote:
> I am programming on iPad. I notice that background applications are not
> allowed for power issues on iPad. I am not sure how to define the concept of
> background applications? In my system, I need to have multiple threads run
> when users interact with my system. The work done by the threads is the
> so-called background applications? If so, threading is not allowed? If not,
> what do background application mean exactly?
On iOS, an application is said to be in the background once the user has tapped the Home button and returned to the home display (or has double-tapped the Home button to expose the recent-app display and selected another app).
This usually means that the application is suspended, but preserved in memory so it can resume when it comes back to the foreground. There are exceptions, if it requests one: It can manage an audio stream or a VoIP conversation; it can have the system monitor a VoIP control port or location events; or it can simply ask for 10 minutes to execute while it is not visible. In any case, if the system needs memory or processor resources for the visible application, a background application may be terminated without notice.
iOS user applications may not fork/exec additional BSD processes.
You seem to be talking about concurrency, in which a single application uses threads to execute more than one independent task at the same time. iOS supports threading, and offers several ways to do it: pthreads, NSOperation, NSThread, and Grand Central Dispatch. Unless you have existing code that uses another technology, Grand Central Dispatch is the recommended method.
A mailing list isn't the place to go into depth. See the Concurrency Programming Guide for an overview and pointers to details. <http://developer.apple.com/library/ios/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html>
— F
_______________________________________________
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