News for hackers. Stuff that matters.
Re: Multitasking - iPhone OS 4 vs Nokia N900 by vetinari on Friday April 09, 2010 @02:20PM (#1253407)
And this is exactly how Android does it - you can spawn thread that will run in background, but it will be a "service" - UI-less part of your application.

In addition, there are events notifying application that it is going to be "hybernated"; basically it tells it to save whatever information it needs to restore into current state.

Re: Multitasking - iPhone OS 4 vs Nokia N900 by DrJokepu on Friday April 09, 2010 @02:31PM (#1253431)
While I'm no expert at Android architecture I own an Android phone and I think there are there are two ways an app can run in the background on Android: first, there are the "background services" (or whatever they are called) but my understanding is that there are also six slots of apps that aren't "hybernated" they're just not "focused" - they might not consume any CPU cycles but they're still in the memory. I would axe this second type of background tasks. Correct me if I'm wrong though, I always wondered how it works exactly.
Re: Multitasking - iPhone OS 4 vs Nokia N900 by vetinari on Friday April 09, 2010 @07:05PM (#1254134)
Actually, there is only one way the application can run in background: the "service".

The "background slots" are implementation details. Applications do not receive the event "you are going to be killed, please serialize" the same moment they lose focus; they receive it at the system's discretion. The system decides based on memory available (mostly), whether it will leave some processes running or whether they will be "backgrounded" (basically, what is more economical - backgrounding processes all the time, when the user is switching between two apps, or just keep them both in memory?).

To some extent, this is tunable by the power users - if they download "Dev Tools", they can set the limit to 1 - 4 processes (or unlimited). It is basically trade off between memory consumption and responsiveness.

I repeat - this is not supposed to be setting for common users; it is just exposed for developers to experiment, what happens when they push the decision threshold in one direction or another. The system is supposed to have good default out of the box and manage the processes automatically (which is also reason, why there is no task manager).