Android employs pre-emptive multi-tasking: the operating system retains control of the CPU even after starting a new process. It will, without warning, shut down background applications to free up memory. (Most modern operating systems on computers with disk drives, as they run low on memory, will swap least-recently-used memory contents to disk. This is called virtual memory. My Android phone has no disk, so there is no virtual memory.)
diagram: Alvaro Fuentes Vasquez (Kronox)
Unfortunately, when it needs memory, Android will shut down background apps without warning. Sometimes it shuts down Tunein, and that app doesn’t allow streams to resume from the interruption point. Trying to resume the audio stream can waste tens of minutes.
High-Level programming provides fast app development but poor control
Android provides high-level system calls to its apps, and the apps are written in high-level languages. The result is that for real-time functions such as streaming media, the user has very little idea of program progress or user control. At least half the time that I try to stream media, my attempt fails a few minutes later, with no real indication of why it failed.
This reminds me of the MS-DOS days: MS-DOS and PC-DOS provided system calls for communication. They were limited and slow, so communication application programmers simply ignored the MS-DOS system calls and instead used low-level routines to talk directly to the underlying hardware. They could do this without breaking the system, because MS-DOS was a single-user, single-tasking operating system. It broke some portability between hardware platforms. The world of Android is much more complex: the phone’s stability requires that each Android app behaves itself by communicating via Android system calls only. (It’s easy to forget that this thing is, after all, a phone.)
I don’t know where this is headed. Clearly Android needs work on its user interface. It probably ought to ask permission before shutting down a background app. It should provide low-level system calls, and the app writers need to use those system calls to improve the interface for the poor Android user.
This article is based upon my experience with my Samsung SGH-T679 Insight II 4G (aka Galaxy Exhibit 4G) T-Mobile phone. It uses Android 2.3.6, which I guess is named Gingerbread.