Scott's Viewport

Monday, December 15, 2008

iPhone Application Sleeping

When an iPhone application isn't in the foreground, it would be nice if it could be sleeping on arbitrary events, either the arrival of a new packet over the Internet, a timer going off, or other events like GPS-determined proximity. But instead of waking up the application, the event should simply inform the user (with icon counters, interactive alerts, or sounds) that something new would happen if the user chose to awaken that application.

This avoids any thrashing between background apps and a foreground app, because they are never running at the same time. Waking a background app swaps its virtual memory in, but it doesn't have to compete with another app in the process.

It's understood that allowing apps to run in the background is a bad idea. But there is really no requirement to have all alerts and notifications go through the bottleneck of Apple's servers in a device with Unix under the hood and full Internet capability. The trick is to ensure that the sleeping background tasks do very little work if and when they wake up, especially any work that would lead to extensive memory access. This is classic interrupt programming, and the iPhone could use it.

Since I'm sure Apple engineer's understand this idea, I believe they are dragging their feet to either a) erect a sufficient walled-garden for these temporarily awoken processes, or b) gain advantage from being the sole conduit for background events, either in terms of marketing research or satisfying contractual requirements with AT&T.

But at some time in the future I assume Apple will let any server anywhere send events to your phone, either as soon as they can do it efficiently, or as soon as the competition offers it.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home