iOS 4.0 Multitasking Explained

Discussion in 'iOS Jailbreak & Cydia' started by Axis, Jun 22, 2010.

  1. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    I've seen a lot of confusion and concerns about multitasking in iOS 4. I will attempt to clarify things.

    It's not really "multitasking".

    Applications do not continue to run at "full steam" when they are sent to the background. Not all apps will need to or be able to execute code in the background. Apple allows developers to declare the following "reasons" for background execution:
    If an app doesn't do any of those things, then it's not actually running in the background.

    If it's not "running", then why is it in the multitasking bar in the dock?

    Background applications remain in memory, even if they are not executing code. This allows for a fast switch back to the foreground. If you are concerned about memory use, don't worry. Developers are strongly encouraged to free memory-hungry objects like images before entering the background state. Also, if system memory gets low, background applications will automatically be purged from memory to prevent problems.

    What about apps that don't support multitasking?

    If an application has not been updated for iOS 4, it will not remain in the background; it will close and open like a normal 3.x application. Even though the icon shows up in the multitasking bar, it's not being treated like a real background app.

    ...
    Source(s): Apple Developer Documentation


    Please post other questions/concerns (and answers if you want

    Please Register or Log in to view images

    ), and I will add them to this post. Also, if I made a mistake, correct me.
  2. SpeedyApocalypse

    SpeedyApocalypse Member

    Joined:
    Dec 27, 2009
    Messages:
    564
    Likes Received:
    13
    Device:
    4G iPod touch
    Thanks for clarifying this - this will definitely answer many questions
  3. bobby681

    bobby681 Active Member

    Joined:
    Jun 24, 2008
    Messages:
    2,588
    Likes Received:
    0
    Device:
    iPhone 4 (Black)
    If you get confused with what's actually multitasking and what's just there because you've used it recently. There's an app in the bigboss repo called Remove Recents. It should make it so only the apps that are multitasking are shown

    Please Register or Log in to view images

  4. jimbeam

    jimbeam Active Member

    Joined:
    Nov 19, 2007
    Messages:
    3,694
    Likes Received:
    12
    Device:
    iPhone 3G (Black)
    Thanks for this. I was curios why multitasking worked perfectly fine on my 3G. I figured it would bring the phone to a screeching halt, but it works pretty good.
  5. fred2028

    fred2028 Member

    Joined:
    Oct 12, 2007
    Messages:
    690
    Likes Received:
    2
    Device:
    iPhone 4 (Black)
    Hmmm then when I open (and then close) Calendar, Phone, SMS, Settings, and Safari, why does my iPhone 3G slow down considerably? None of those use any of the backgrounded features ...
  6. bahamutspirit

    bahamutspirit New Member

    Joined:
    May 3, 2010
    Messages:
    1,650
    Likes Received:
    0
    Device:
    iPad 2 (Black)
    I would add that... for some apps, the developer might opt to save the state of the app into a file before the app itself is closed down completely, sending only its icon to the task bar. This method has been employed by some apps and games for quite a while now, and those apps will not need to be updated to support multitasking at all.

    Obviously, IM apps that support push notifications also won't need to be updated at all...

    Most apps get a certain time window (I think about 1.2 seconds) to quickly load the necessary data it needs for the most basic operations, this will happen within the time it takes for the app-launching operation to finish in the Springboard. The rest of the app will then get loaded after the launch has completed. So most apps will launch really fast. The app-switching animation of the new multitask feature is also just as long, and within the time it takes for the animation to complete, a completely closed-down app would have been successfully launched. That means whether the app was closed down or not, you get super smooth and responsive app switching still, and with apps saving their states, it would feel like it never closed down at all. But I guess you would already know what it's like.

    So it's not really multitasking for the device, but it will let you multitask (or run multiple applications at once) alright. There's a difference here in case you wonder. It's that the device does not multitask, not that you yourself as a user cannot multitask on the device. I often get people complaining that a device can't multitask and this and that, but the truth is that as long as the user can accomplish many tasks at the same time on the device, it's still multitasking.

    Oh, and also note that some Apple apps will remain running in the background almost forever after they have been launched regardless of whether or not you use them or ever switch back to them. They will be closed down in the extreme condition that even more free memory is needed and that they haven't been used for a very long time, but the general rule is... apps were developed with those Apple apps running in the background taken into account.

    So realistically, at 256MB of RAM, an app developer should expect to use only about 30% of that and the other 70% has been taken up by Apple stuffs. Oh but do note that this is not the case all the time. It depends on how you use the device, but that's the expectation. If an app needs more, the OS always tries to free up more and close down the Apple stuffs, but just to say, most apps already took them into account.

    Yes, it's worse on iPhone 3G and older devices, and that's why Apple didn't allow it. In the worst case scenario, iPhone 3G will keep trying to free up memory and slow down substantially. Of course, if you lay off running too many Apple apps, you'll probably squeeze through it just fine.

    But this doesn't mean more than 256MB of RAM will be immediately better, by the way. 256MB already allows for a lot. And Apple needs more memory only to execute extra daemons like FaceTime, and other features of iPhone 4. This is not so you will think iPhone 4 will be better and expect miracles, as it'll probably run out of RAM really fast as soon as you switch out of your current app into a phone call with FaceTime... if it had 256MB of RAM, you'd lose any app in the background while making a phone call with FaceTime, and that wouldn't be good PR for Apple.
  7. fred2028

    fred2028 Member

    Joined:
    Oct 12, 2007
    Messages:
    690
    Likes Received:
    2
    Device:
    iPhone 4 (Black)
    The thing with that though is you don't get to choose what is or isn't multitask-ed after you press Home. You have to double-click Home after, then close it manually, which is a huge PITA. So on the 3G, your RAM runs out quickly regardless unless you spend the hassle of manually closing everything you wanted to close when you pressed Home. I know this for a fact since this happened to me last night, which caused me to re-JB without multitasking. 3G running Calendar, Phone, SMS, Settings, and Safari was very slow. And I didn't even want any of them to multitask; I merely "closed" the app by single pressing Home.
  8. matt912836

    matt912836 Member

    Joined:
    Aug 1, 2009
    Messages:
    292
    Likes Received:
    4
    Device:
    iPhone 4 (Black)
    And that's why multitasking is not supported by Apple. People think that you can enable it with a plist edit and it works just fine, the truth is it works "fine" at this point because none of the apps they're using now actually support multitasking.
  9. bahamutspirit

    bahamutspirit New Member

    Joined:
    May 3, 2010
    Messages:
    1,650
    Likes Received:
    0
    Device:
    iPad 2 (Black)
    Even if the icon is there, the app might not be running at all. So the fact is that any app you have ever opened ever since the device was turned on until now will remain in that dock or task bar whether it's still running or not.

    Weird, I know, and you actually won't get to know what is actually running and what isn't. Not that it's an issue. But on the 3G, I would guess that it's because the extra services, or daemons required for multitasking are taking up CPU time, and because of that the device may slow down at times. With Safari running quite sluggish (compared to 3GS) as is, you would think it can't get any worse.

    In any case, the services that allow for location services, VoIP services, and music services will always be running and waiting for other apps to send them something to do. That's actually 3 more apps running in the background, and those won't ever get freed up or closed down. They will remain there for ever and ever. RAM is also an issue, but that can be automatically managed by the OS.
  10. Beans48

    Beans48 New Member

    Joined:
    Mar 21, 2010
    Messages:
    345
    Likes Received:
    0
    Device:
    3G iPod touch
    So how long do the icons in the multitasking bar stay there before going away on their own?

Share This Page