View Single Post
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#1164
Originally Posted by danramos View Post
Correct me if I'm wrong, but isn't the purpose of 'cooperative multitasking' that the OPERATING SYSTEM decides when to halt and execute running software in a fast "app switching or another funny description" method? The other alternative would be "preemptive multitasking", which is where the APPLICATION decides when to allow another application to be able to have a slice of time and the operating system isn't deciding when to halt and execute running software. My impression is that each of these systems employs some mixture of BOTH of these multitasking principles. In the case of Android, at least, I know you can use BOTH methods and the author can employ either method on a per-thread level.
The above text is confusing multitasking methods (cooperative, preemptive) with suspending x swapping running software.

On Maemo/MeeGo (like any Linux distribution) a running software can use RAM or swap memory (when there is not enought RAM, but it is a lot slower) and only you decide to close (or stop) running softwares (or if the OS lacks real and virtual RAM, the running processes with less priority will be closed as needed). So you have the freedom to leave any software (with GUI or not) in background, any number of them, for any time you want. With this freedom comes the responsibility : the system can become slow if a lot of swap memory is used, the CPU can hit 100% and the battery will drain, etc.

While Android (or iOS & WP7) decides by itself to suspend running softwares (i.e., so the software is not using CPU cycles, not running in background) to save battery, RAM, etc. The "recent app list" of both Android 4.0 & iOS doesn't show running softwares, just the most recent softwares : some softwares suspended can be there, and some running softwares are not there... For Android, just use SystemPanel software (free & paid versions) which shows a real picture of running, suspended, etc, softwares.

The advantage of Android over iOS and WP7 is that a software can remain in background (without being suspended in normal situations, i.e., if there is enough RAM) if it is separated in a service (so the software is divided in client+server solution). But AFAIK, software services in Android cannot update GUI in background.

Here we can see that Android doesn't have swap memory*, so only real RAM is used. So everytime RAM is low, softwares running in background (including services) are suspended/closed :

"If there is too little RAM, processes hosting services will be immediately killed like background processes are. However, if appropriate, Android will remember that these services wish to remain running, and restart their process at a later time when more RAM is available. For example, if the user goes to a web page that requires large amounts of RAM, Android may kill background service processes like sync until the browser's memory needs go down."
So, even the 1 GB of RAM of my Asus Transformer TF-101 seems to be not enough for my usage due to the not real multitasking of Android 4.0 : a web browser with many tabs and a PDF document that I "left open" can sometimes be suspended/closed by the Android OS so the documents/sites are reloaded when I open them again. I have experienced this problem many times. By comparison, doing the same thing on Nokia N9 or even N900 doesn't give any problems of reloaded sites, documents, videos, etc.

(*) : I've seen references of swap memory use on Android for modified ROM's (Cyanogenmod, etc) or swap being enabled. But it seems a vanilla Android is not expected to have swap memory.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2012-05-09 at 17:37.