There are still a lot of people who don't know how multitasking works in iOS. To begin with, however, it is necessary to point out that this is not real multitasking, but a very smart solution that does not burden the system or the user.
One can often hear superstitions that apps running in the background in iOS fill up the operating memory, which leads to system slowdown and battery life, so the user should turn them off manually. The multitasking bar does not actually contain a list of all running background processes, but only the most recently launched applications. So the user doesn't have to worry about processes running in the background except in a few cases. When you press the Home button, the application usually goes to sleep or closes, so that it no longer loads the processor or the battery and, if necessary, frees up the necessary memory.
So this is not full-fledged multitasking when you have dozens of processes running. Only one application is always running in the foreground, which is paused or turned off completely if necessary. Only a few secondary processes run in the background. That's why you will rarely encounter an application crash on iOS, for example Android is overwhelmed with running applications that the user has to take care of. On the one hand, this makes working with the device unpleasant, and on the other hand, it causes, for example, slow startup and transitions between applications.
Application runtime type
The application on your iOS device is in one of these 5 states:
- Running: the application is started and running in the foreground
- Background: it is still running but running in the background (we can use other applications)
- Suspended: Still using RAM but not running
- Inactive: the application is running but indirect commands (for example, when you lock the device with the application running)
- Not running: The application has terminated or has not started
The confusion comes when the app goes into the background so as not to disturb. When you press the Home button or use the gesture to close the application (iPad), the application goes into the background. Most apps are suspended within seconds (They are stored in the iDevice's RAM so they can be launched quickly, they don't load the processor as much and thus save battery life) You might think that if an app continues to use memory, you have to manually delete it to free it up . But you don't have to do that, because iOS will do it for you. If you have a demanding application suspended in the background, such as a game that uses a large amount of RAM, iOS will automatically remove it from memory when necessary, and you can restart it by tapping the application icon.
None of these states are reflected in the multitasking bar, the panel only shows a list of recently launched apps regardless of whether the app is stopped, paused, or running in the background. You may also notice that the application that is currently running does not appear in the Multitasking panel
Background tasks
Normally, when you press the Home button, the application will run in the background, and if you are not using it, it will automatically pause within five seconds. So if you're downloading a podcast, for example, the system evaluates it as a running application and delays the termination by ten minutes. After ten minutes at the latest, the process is released from memory. In short, you don't have to worry about interrupting your download by pressing the Home Button, if it doesn't take more than 10 minutes to complete it.
Indefinite running in the background
In the case of inactivity, the system terminates the application within five seconds, and in the case of downloads, termination is delayed for ten minutes. However, there are a small number of applications that require running in the background. Here are some examples of apps that can run in the background indefinitely in iOS 5:
- Applications that play sound and must be interrupted for a while (pausing music during a phone call, etc.),
- Applications that track your location (navigation software),
- Applications receiving VoIP calls, for example if you use Skype, you can receive a call even when the application is in the background,
- Automatic downloads (eg Newsstand).
All applications should be closed if they are no longer performing a task (such as background downloads). However, there are exceptions that run in the background continuously, such as the native Mail app. If they are running in the background, they take up memory, CPU usage or reduce battery life
Apps that are allowed to run in the background indefinitely can do anything they do while they're running, from playing music to downloading new Podcast episodes.
As I mentioned before, the user never needs to close the apps running in the background. The only exception to this is when an app running in the background crashes or doesn't wake up from sleep properly. The user can then close the applications manually in the multitasking bar, but this rarely happens.
So, in general, you don't need to manage background processes because the system will take care of them itself. That's why iOS is such a fresh and fast system.
From a developer's perspective
The application can react with a total of six different states as part of multitasking:
1. applicationWillResignActive
In translation, this state means that the application will resign as the active application (that is, the application in the foreground) in the future (a matter of a few milliseconds). This happens, for example, when receiving a call while using the application, but at the same time, this method also causes this state before the application goes into the background, so you need to take these changes into account. This method is also suitable so that, for example, it suspends all the activities it is performing when there is an incoming call and waits until the end of the call.
2. applicationDidEnterBackground
The status indicates that the application has gone into the background. Developers should use this method to suspend all processes that don't necessarily need to run in the background and clear memory of unused data and other processes, such as expiring timers, clearing loaded images from memory that won't necessarily be needed, or closing connections with servers, unless it is critical for the application to complete connections in the background. When the method is invoked in an application, it should essentially be used to completely suspend the application if some part of it is not required to run in the background.
3. applicationWillEnterForeground
This state is the opposite of the first state, where the application will resign to the active state. The state simply means that the sleeping app will resume from the background and appear in the foreground within the next few milliseconds. developers should use this method to resume any processes that were inactive while the application was in the background. Connections to servers should be reestablished, timers reset, images and data loaded into memory, and other necessary processes can resume just before the user sees the loaded application again.
4. applicationDidBecomeActive
The state indicates that the application has just become active after being restored to the foreground. This is a method that can be used to make additional adjustments to the user interface or to restore the UI to its original state, etc. This actually happens at the moment when the user already sees the application on the display, so it is necessary to determine with caution what happens in the method of this and in the previous method. They are called one after the other with a difference of a few milliseconds.
5. applicationWillTerminate
This state happens a few milliseconds before the application exits, that is, before the application actually terminates. Either manually from multitasking or when turning off the device. The method should be used to save processed data, to end all activities and to delete data that will no longer be needed.
6. applicationDidReceiveMemoryWarning
It is the last state that is the most discussed. It is responsible for, if necessary, removing the application from iOS memory if it uses system resources unnecessarily. I don't know specifically what iOS does with background apps, but if it needs an app to release resources to other processes, it prompts it with a memory warning to release whatever resources it has. So this method is called in the application. Developers should implement it so that the application gives up the memory it has allocated, saves everything in progress, clears unnecessary data from memory, and otherwise adequately frees memory. It's true that many developers, even beginners, don't think about or understand such things, and then it can happen that their application threatens battery life and/or unnecessarily consumes system resources, even in the background.
Verdict
These six states and their associated methods are the background of all "multitasking" in iOS. it's a great system, as long as developers don't ignore the fact that there is a need to be responsible about what the application throws up on their users' devices, if they are minimized or get warnings from the system and so on.
Source: macworld.com
Authors: Jakub Požárek, Martin Doubek (ArnieX)
Do you also have a problem to solve? Do you need advice or perhaps find the right application? Do not hesitate to contact us via the form in the section Counseling, next time we will answer your question.
Hello, really cool article, but I wonder if you have any technical support for it. Because I have solved the battery several times in the evening before going to bed and it happened that with wifi and mobile data turned off, it took more than in another case with wifi turned off and only 3G.
Unfortunately, the experience is that in iOS, applications have to be turned off manually, and the system no longer runs as well as before.
I replaced my iPhone with a Windows Phone (Samsung Omnia W for 6200,-) and the speed of the system is on a completely different level.
I'm afraid that when the Windows 8 Metro tablets come out, I'll also replace the iPad...
@007 – yes, if you're comparing the old iPhone3Gs to the new WP ones, then yes (who would have expected that?) the WP will be quite a bit faster. Otherwise, the gossip about Karlulka does not go well with you and it was appropriate to compare the current HW. I also bought WP7 and finally ended up with 4s, which represents a completely different level of usability than WP7. So pass pleasantly and endlessly scroll through the tiles.
I totally agree with Paja
I would contribute again from the debris of another barrel - Samsung Galaxy S and iPhone 4 - I would say comparable in terms of age? At the time of iOS 4, and in terms of usability and speed somewhere other than Android, Apple has solved the concept of working with applications very well, but the same is no longer true with Android. In the end, I ended up with the 4S anyway and I have no complaints, because "it just works" .. and it works very quickly!
The theory is beautiful... But in practice, I still close the application in the bar ;)
Thanks, very interesting, pragmatic, interesting, it does not lack swing and depth. Significantly underlining the obsession of today's youth with this forbidden brand! But thanks for her, as well as for this article.
The article is completely wrong.
The application does not quit when the Home button is pressed, as erroneously stated, but pauses. I.e. definitely don't delete from memory and don't quit. Just pause the run, iOS will give this app 0% CPU time. It definitely does not "swap" anywhere in the iDevice memory, as stated in the article. It is really thanks to the fact that it is possible to use the app switching.
The application is removed from the memory when the phone has little memory to run other applications with a higher priority (typically another application is running in the foreground).
In the first case, you are right, it was a translation error. As for swapping, we are not talking about that here, we are talking about the operating memory, not the storage space in the iOS device.
the image of the application is stored in memory for a limited time until it is called up again by a command (see 13,7 GB out of 16 GB: the 2,3 GB is reserved for the system and suspended applications)
Thus, it is necessary to distinguish between applications such as Navigation, Skype and the like, these applications remain active even in the background, or a certain function does not end and continues, for example, to send data about its location or location information. Or like Vokul in pord mode listen and multitasking is still listening in the background.
These applications drain the battery and it is necessary to close them manually and not wait for iOS. with others it is not necessary, there only in case the application crashes.
I cannot agree with the article. Min. on a 1st generation iPad (iOS 5.0.1) it's clear to see if I have a lot of "open" apps in the multitasking bar or just a few. iOS does try to clean the memory, but it is obviously not enough - the small size of the RAM is probably its biggest weakness.
so a lot depends on the system and the hardware used, it is quite logical that it will be worse on an iPad 1 with iOS 5.0.1 than if it were on a 2nd generation iPad
Sorry mate, this is a description of the IDEAL way it should work. Unfortunately, the reality is completely different and you would know it if you used Apple products, at least as much as I do (ie occasionally).
"You can often hear superstitions that apps running in the background in iOS fill up the operating memory,"
It's not a superstition, it's just a fact. After all, you claim it yourself in the article.
"As I mentioned before, the user never needs to close the applications running in the background."
NONSENSE. That's just bullshit, apple propaganda, don't get mad at me.
“But you don't have to do that, because iOS will do it for you. If you have a demanding application suspended in the background, such as a game that uses a large amount of RAM, iOS will automatically remove it from memory when necessary, and you can restart it by tapping the application icon.”
Not true. The situation is a little different. A typical example – I have demanding applications running in the background, I need games. I launch the browser, open a couple of tabs -> need more memory. What will happen? I keep demanding applications in the background, on the contrary, THE BROWSER ITSELF FALLS. If I close the demanding applications manually, the browser works for a long time without any problems.
This is practice, not theory. And I'm surprised that, as a long-term user of an Apple product, you still don't know this.
Thanks, this is very well described and well explained. You have helped me quite a bit ;-) ♥
Just for an introduction, I'm neither for nor against iOS, just like with Android, but there are a few strange things here, if as it is written here: "you rarely encounter an application crash with iOS", then with Android, applications probably crash once a year: -P
http://dotekomanie.blog.mobilmania.cz/2012/02/stabilita-ios-vs-android/
Yes, but the cases when you need to close the application manually are really minimal, I used it about once? ;-) and giving a link to the comparative test from Mobilemania is quite pointless, when I want to read about the advertising that Google paid, I'll take a look there ;-) everyone can get any android phone in their hands and it won't run cleanly, that is, with the exception of the Galaxy Nexus, which is the system is more or less tailor-made. Overall, android is a disaster
@Mek – I've been using Apple products daily for several years and this has never happened to me, so your theory somehow doesn't work.
WEED:
@redakce – You can see that the website is constantly being worked on or something is happening with it, but I have the feeling that it doesn't take a week for everything to work as it should. And I don't really come here anymore, because the new look doesn't suit me. At least I used the mobile version on the iPhone, but it doesn't work at all - how come? They are currently not responding to posts in the comments.
@SteveJSF Unfortunately, things don't always turn out the way we want them to. As for the answers, the new SEO plugin broke them, it's currently being resolved.
WP-Touch also terminated our service for some reason, so we decided to come up with a better solution than this plugin. So you can look forward to the next news soon :-)
Nice article. As far as practice is concerned, I would like to say that I agree with several things and most of the time it works as stated, but unfortunately there are still poorly written applications that do not behave correctly, and then there are cases like the one noted by some readers. I think that Skype is a very good example, I know from practice that it is still running in the background (and that's fine and that's how it should be), but the problem is that this application drains the battery of the device a lot and I can't see it properly anymore . Conversely, applications such as Facebook, Badoo, etc. they are also still running in the background, but their consumption is almost imperceptible (at least I don't notice any). So I think the error is in the individual applications. If you knew which ones, it would be enough to turn off manually only those!
So the practice is that Facebook runs as needed and Skype only when needed.
Well, on the other hand, if I need to save battery and I know I have to keep the iPhone "alive" as long as possible, I also turn off everything unnecessary in multitasking, but mostly it doesn't have a big impact, but if necessary I limit 3G, all mobile internet, WiFi, location services , airplane mode, lighting strength, etc. As part of the routine, I also turn off the aforementioned applications in multitasking.
So personally I think that the article is true, unfortunately some programmers refute these things with their applications, because their applications are incorrect and in my opinion there are only two solutions for this 1. If it is possible not to use the application and find an alternative if possible, or 2. If it is not possible, see e.g. Skype, write it to the given programmer in the report and hope that they will do something about it.
It may be pointless to disable apps manually, but I do it anyway. I also tried not to turn off the application system, let them run (or leave them asleep in the background) and the battery life was much lower, it was also necessary to restart the iPad 2 after about three weeks, it responded slowly. So I turn off the apps manually, the battery lasts longer, I recently rebooted on Christmas Day and it's running fine.
By the way, I do the same thing in Mac OS X, I just close the application I don't need (CMD+Q), it's better than having it sleep in the background and eat up RAM unnecessarily (which OS X can't work with very well). I have little RAM, only 8 GB, but in Windows 7 with 8 GB, the system did not respond slowly or swap, in OS X this is a fairly common phenomenon (I never turned off the computer, I do it with Mac too, so a month and more up time is not an exception, the problem is that I sometimes have to restart the Mac as a precaution to free up RAM and "speed up", Windows 7 does not need this).
I'm more interested in how to actually blast the application. What happened to me was that the application (specifically on Geocaching) got into a state where it was loading something from the parent server and got stuck in that state. Home button worked, after reboot it went back to frozen state (where I left off). Manual exit (to the multitasting menu, hold the icon and minus to close) = the application disappeared, after restarting it opened in its original state where it froze. So I closed everything, turned off the phone, turned it on, double-clicked HOME and lo and behold – the applications were all there as they were before they were closed just before turning off. The restart didn't help either - hold home and upper until it gets hot. The only thing that helped was removing the application from the phone, restarting it, and reinstalling it on the phone. Somehow I didn't take it.
This Multitasking management works and it is very much up to the developers to cope with these situations. For those interested in a more detailed and professional description of the whole situation, I will write here how it is.
The application can respond to a total of 6 states and these states are:
applicationWillResignActive
applicationDidEnterBackground
applicationWillEnterForeground
applicationDidBecomeActive
applicationWillTerminate
applicationDidReceiveMemoryWarning
Now I will try to describe these states in more detail.
applicationWillResignActive – this state means that in the future (a matter of a few milliseconds) the application will resign as the active application (i.e. the foreground application) this happens for example when receiving a call while using the application, but at the same time this method therefore this state will trigger even before the application goes into the background, so you need to take these changes into account. This method is also suitable so that, for example, it suspends all the activities it is performing when there is an incoming call and waits until the end of the call.
applicationDidEnterBackground - this status indicates that the application has entered the background, developers should use this method to suspend all processes that do not necessarily need to run in the background and clean memory of unused data and other processes, for example, expire timers, clear from memory loaded images that will not necessarily be needed or terminate the connection with the servers if it is not critical for the application to complete the connection in the background. Basically, this method when called in the application should be used to completely suspend the application if some part of it is not required to run in the background.
applicationWillEnterForeground – this state is the opposite of the first state when the application will resign to the active state. This application state simply means that in the next few milliseconds the sleeping application will resume from the background and appear in the foreground (the application enters the foreground), this method should be used by developers to resume any processes that were inactive while the application was in the background , connections to servers should be reestablished, timers reset, images and data loaded into memory, and other necessary processes can resume just before the user sees the loaded application again.
applicationDidBecomeActive – this status indicates that the application has just become active after being restored to the foreground, this is a method that can be used to make additional adjustments to the user interface or restore the UI to its original state, etc. this method actually happens when the user already can see on the display, so it is necessary to determine from the balance sheet what is happening in this method and in the previous method. They are called one after the other with a difference of a few milliseconds.
applicationWillTerminate - this state happens a few milliseconds before the application terminates, that is, before the application actually terminates. Either manually from multitasking or when turning off the device. This method should be used to save processed data and to end all activities and delete data that will no longer be needed.
applicationDidReceiveMemoryWarning - and this is a condition that is discussed a lot here, if necessary, iOS will remove the application from memory if it uses system resources unnecessarily. I don't know exactly what iOS does with background apps, but if it needs an app to release resources to other processes, it prompts it with a memory warning to release the resources it's holding. So this method is called in the application, and the developers should implement it so that the application gives up the memory it has, saves the processed and deletes unnecessary data from the memory, and otherwise adequately frees the memory. It is true that many developers, for example beginners, do not think about such things or do not understand them, and then it can happen that their application endangers battery life and/or unnecessarily consumes system resources even in the background. I don't know how iOS will behave if the application does nothing after receiving a memory warning and continues to consume system resources as before.
These few states and associated methods are behind the whole "multitasking" in iOS... it's a great system if the developers don't ignore the need to be responsible about what the apps will throw up on their users' devices if they are minimized or get warnings from the system and more …
I hope this brief description helps you understand how the application is involved in making everything work smoothly. So it is almost possible to say that it is a mistake of incorrect usage by the user, which can be understood as - if you use mostly free applications from amateur developers in large numbers, your iOS device will run worse than if you use a large number of free and paid applications from experienced or professional developers. This is not to say that there are no exceptions in both circles. For example, foursquare behaves quite strangely and demandingly, and at the same time, one would expect that they are very skilled developers who give a lot of time to memory and battery management, but the opposite is true. The biggest problem with 4SQ is communication with servers, which often hangs and is overwhelmed. This is just an example of the fact that even well-known applications have problems, which does not change the fact that 4SQ is a great service.
Have fun Apples!! :)
We added the information to the article with the kind permission of the author ;-)
I'm sorry, ENTER was everywhere between paragraphs, they could do something about it here so that the comments have at least a little bit of RICH TEXT FORMATING.
ArnieX: thanks for the comment!!
That Faramir: I just about your problem, I don't know if it will help in your case, but I know from my own experience that if you close the application (in multitasking) it takes a few seconds until it closes, so if you turn it off I recommend waiting a few seconds (I I wait approx. 10 seconds to be sure) until it is definitely finished and only then do I start it again.
You're welcome ;) I'll be happy to help if I have the opportunity to contribute.
How is it supposed to be with Meeb, when I log in to ICQ or FB chat through it, it automatically logs out after 10 minutes and I go offline or does it continue to work? thanks for the clarification :P
After ten minutes, the application's connection to the Internet is simply interrupted. However, you will still be online on the Meeba server and you will receive a push notification if someone writes to you. After reopening the application, the connection will be established in a moment and you can continue chatting happily.
So, if I understood the article you linked correctly, the statistics only refer to application crashes when they start, which is a fairly small percentage of cases where a crash can occur. Therefore, it is impossible to conclude from this "research" that iOS is less stable in my opinion. Furthermore, the translator of the article taken from Forbes forgot to mention that the company that provides data on application crashes is supported by Google, among others ("Crittercism, which is backed by Google Ventures,...").