What did iOS do before multitasking?
Was there an app switcher or did you have to stop an app and start a new one?
Solution 1:
The app switcher came with limited multitasking. Before that, you pressed the home button and the front program stopped running.
Solution 2:
FWIW, Apple has always allowed some of their own apps or services to persist in the background, i.e. the Phone, Mail, push notifications, Find My iPhone, and so on, based on the need and functionality.
One thing to consider is that multitasking today on iOS is still limited, especially when compared to desktop operating systems (and perhaps some Android environments).
Beginning with iOS 4, Apple gives you the illusion that all your apps are running by having created the app switcher. While some of the apps may still be running, most are in hibernation, depending on what background tasks they've registered to run and what RAM is available.
The app life cycle has generally behaved like this since day one:
- User taps app icon
- Launch screen is shown
- First screen (view) is loaded
- User does stuff with app
- User pushes home button (or, with later versions, tapped screen of another app)
- Previously opened app gets signal that it is no longer in foreground
- App gets signal that it's about to be suspended
- App is suspended (state saved in RAM)
- App's state is moved from RAM to disk (flash) when RAM fills up
- User returns to app
- If state is recent enough, state is reloaded from RAM or disk
- If state is stale, app starts over fresh
Nuances in how state is dealt with have changed over the years, and developers have been increasingly given more control over what they can do in between states.
When people go through and "force close" all their apps, they essentially are throwing away any state saved by the app, and killing any background tasks that app may have started. Many think they are helping to reduce battery consumption and keep RAM clean, but Craig Federighi pointed out that by doing so they may actually cause more battery drain, since the CPU is doing more to reopen those apps every time instead of merely bringing them out of stasis.
Also since iOS 4, developers are now allowed to create tasks that can persist even if an app has been suspended, such as audio playback, monitoring network traffic (VoIP), background data refreshes, and location updates. This is effective because only a portion of the app is running and using resources.
As devices get more powerful (more CPU, more RAM, more storage, bigger battery) and as code gets more efficient, these additional tasks prove to be less of a drain on resources. Newer things like widgets and the forthcoming Siri, iMessage, and CallKit extensions can make it appear like popular apps are always doing something in the background.
Solution 3:
Initially, iOS did not have multitasking. Their first attempt was in 2010 (holy crap!). The iPhone just didn't have enough ram and wasn't optimized for it. In 2010, Apple enabled the core apps to multitask, but not 3rd party. I remember jailbreaking my device to bypass that to allow all apps to multitask, but it was buggy. iOS has come a long way folks, with 64bit processing and better memory management.
For further reading, take a look at the Wikipedia article.