We all know the lesson "multitasking = the ability to perform several processes at the same time". We use it in our computers without being particularly aware of its presence. Switching between applications or windows of one application takes place (for us) in real time and we take this capability of the operating system for granted.
Task different
The operating system allocates the processor to all applications in small time intervals. These periods of time are so small that we cannot notice them, so it seems as if all applications are using the processor at the same time. We might think so multitasking in iOS 4 works exactly the same. It is not so. The main reason is of course the battery capacity. If all the applications were really left running in the background, we would probably have to look for a socket in a few hours.
Most applications compatible with iOS 4 are put into "suspended mode" or put to sleep after pressing the Home button. An analogy might be closing the lid of a laptop, which immediately goes into sleep mode. After opening the lid, the laptop wakes up and everything is in exactly the same state as before the lid was closed. Furthermore, there are applications where pressing the Home button causes them to end. And by that we mean a real termination. Developers have a choice of which of these methods to use.
But there is another category of applications. These are the apps that really run in the background, even though you're doing something completely different on your iDevice. Skype is a good example because it needs a constant internet connection. Other examples could be applications playing background music (Pandora) or applications requiring constant use of GPS. Yes, these apps drain your battery even when running in the background.
Sleep or shoot down?
Certain applications compatible with iOS 4, which should be put to sleep (put into "suspended mode") after pressing the Home button, continue to run in the background. Apple gave developers exactly ten minutes for the app to complete its task, whatever it was. Let's say you're downloading a file in GoodReader. Suddenly someone wants to call you and you just have to accept that important call. The call did not last more than ten minutes, you will return to the GoodReader application. The file may already be downloaded or is still being downloaded. What if the call takes more than ten minutes? The application, in our case GoodReader, will have to stop its activity and tell iOS that it can be put to sleep. If she doesn't, she will be mercilessly terminated by iOS itself.
Now you know the difference between "mobile" and "desktop" multitasking. While fluidity and speed of switching between applications are important for a computer, battery life is always the most important thing for mobile devices. Multitasking also had to be adapted to this fact. Therefore, after reading this article, if you press the Home button twice, you will no longer see the "bar of applications running in the background", but essentially only the "list of recently used applications".
Author: Daniel HruškaSource: onemoretap.com
hmm, interesting :) I always thought that it was always similar to how it can be done on Unix. That the application has been allocated zero CPU time and the process just sits in memory, all resources have been allocated. so I had to press home twice and immediately stop the application to delete it. So does this mean that even if there is an application icon in the lower hidden sheet, the app is still closed a long time ago (after 10 minutes)?
In the bottom list, there are simply the most recently opened applications, whereby some of them can still run, some are suspended, and some are terminated completely. Manually removing the application from the list has the "side effect" that if it happens to be running (or is suspended) it will be terminated.
The application has to tell itself about those 10 extra minutes, and it is not guaranteed that it will get them.
Well, that didn't get rid of my obsession with closing the application from the list (what if it accidentally eats resources, right? :-D)
My understanding is that the 10 minutes is for apps that need to work in the background and don't fall into the "skype, GPS and music playback" category. Other applications switch to suspended mode and stay in memory until the memory is needed for other things.
Suspended mode has the advantage that if you need to kill the app, you will not lose its data, everything will be saved at the moment of switching to suspended.
or, in the case of e.g. playback, the equivalent of the command bg / fg
And what about the player or other applications running in the background for any length of time? I mean, do I get to "choose" as a developer, or does this have to be approved by Apple somehow?
In order for the application to really run in the background for an unlimited time, it must do (register) one of the following actions:
– Use Location services (GPS)
– Play music in the background
– Use VOIP (Voice over IP)
According to the title (a look under the hood), I expected the article to contain a somewhat more extensive explanation with technical details. This looks more like a perex to the article. If it's perex, when is the sequel? Can you get a refund? :-)
and what would you like to know in more detail?
From an article with "under the hood" in the title, I would expect a detailed technical description (the author could analyze, for example, overhead when switching applications, or how simultaneous access to system resources is solved), a comparison with other models (for example, with a jailbroken iPhone). It is ideal to back it up with some measurements. I simply expected much more from an article that has "under the hood" in its title than this very superficial description.
Is there any icq client that runs continuously in the background like skype and doesn't drop the connection?
the application has 10 seconds to go into suspend mode, not 10 minutes... and during this process, some parts may or may not "hang" on backend services, some of which have already been listed above - that's what Apple calls "smart" multitasking.... then the system shot her down
The application may require additional time if something is being downloaded, uploaded or processed. It has nothing to do with GPS, VoIP or playing music, which run in minimalist mode for an unlimited time.