The new feature was highlighted by Apple's chief executive Steve Jobs as one of the top 7 "tent pole" features of the new release, along with 100 other user features and hundreds of new features for developers to leverage in their apps.
"We weren't the first to this party," Jobs said of the new multitasking feature, "but we're going to be the best. Just like cut and paste."
"iPhone OS 4 provides multitasking to third party apps while preserving battery life and foreground app performance, which has until now proved elusive on mobile devices," Apple said in a press release.
The new feature enables users to launch multiple background apps, and then from any running app (or from the Home screen), call up a "multitasking tray" of the currently running apps, which the user can then immediately switch to.
Jobs demonstrated jumping back and forth between the iPhone's Safari browser and Mail, then jumped into a running game to continue from the previous game.
How Multitasking works in iPhone 4.0
Apple's Senior Vice President of iPhone software Scott Forstall appeared on stage to explain how the company had added multitasking without incurring a performance hit. iPhone 4 will add seven different multitasking services APIs for developers, he explained, each tuned to solve different multitasking scenarios.
One, demonstrated by Pandora's Internet radio streaming app, will allow apps like it to play music in the background, with playback controls available even at the lock screen.
Voice over IP
A second example involves VoIP, which enables apps like Skype to continue to receive calls even when the calling app is not the foreground app.
A third mechanism is background location, which can be used by direction apps such as TomTom or social media apps like Loopt. Rather than constantly polling GPS (something that kills the battery rapidly) the new system calculates location from cellular sites
Push Notifications and Local Notifications
A fourth and fifth enhancement relates to Apple's existing push notification service and a new "local notifications" service that allows apps to post reminders or other events without using Apple's servers.
A sixth feature, task completion, will enable an app to start a job and continue working on it after the user leaves the app. And example given cited an app posting photos to Flicker, which continued working after the user left that app.
Fast App Switching
The seventh multitasking mechanism is fast app switching, which "allows you to restore the state of an app when you switch out and back," is the easiest to implement, essentially freezing the progress of an app such as a game while the user handles another task in another app.
iPhone and iPod touch model support
The iPhone 4 update will bring multitasking features to the existing 2009 iPhone 3GS and 3G iPod touch models with 32 and 64GB of storage. Earlier models from 2008 (iPhone 3G and the 2G iPod touch, as well as the low end 2009 models based on those designs) will be able to install the iPhone 4 update but will not be able to use multitasking because those devices lack the system RAM and processing power required.
The original iPhone and iPod touch models from 2007 will apparently not be supported by iPhone 4. At its release, they will be four years old.
Apple said "a version of iPhone OS 4 will be coming to iPad this Fall."