Hi, You might be aware of the memory concept of android. Here I have described the basic memory concept in android,
Introduction about Android memory
Android
Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
Android Memory
Android is a Linux based OS with 2.6.x kernel, stripped down to handle most tasks pretty well. It uses native open source C libraries that have powered Linux machines for years. All the basic OS operations like I/O, memory management, and so on, are handled by the native stripped-down Linux kernel.
How to use memory for each application
Android’s process and memory management is a little unusual. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the process lifetimes. Android ensures application responsiveness by stopping and killing processes as necessary to free resources for higher-priority applications.
Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memory and process management to the Android run time, which stops and kills processes as necessary to manage resources.
Dalvik and the Android run time sit on top of a Linux kernel that handles low-level hardware interaction including drivers and memory management, while a set of APIs provides access to all of the under- lying services, features, and hardware.
Dalvik Virtual Machine Dalvik is a register-based virtual machine that’s been optimized to ensure that a device can run multiple instances efficiently. It relies on the Linux kernel for threading and low-level memory management.
The Dalvik Virtual Machine
One of the key elements of Android is the Dalvik virtual machine. Rather than use a traditional Java virtual machine (VM) such as Java ME (Java Mobile Edition), Android uses its own custom VM designed to ensure that multiple instances run efficiently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality including security, threading, and process and memory management.
All Android hardware and system service access is managed using Dalvik as a middle tier. By using a VM to host application execution, developers have an abstraction layer that ensures they never have to worry about a particular hardware implementation.
The Dalvik VM executes Dalvik executable files, a format optimized to ensure minimal memory foot- print. The .dex executables are created by transforming Java language compiled classes using the tools supplied within the SDK.
Understanding Application Priority and Process States
The order in which processes are killed to reclaim resources is determined by the priority of the hosted applications. An application’s priority is equal to its highest-priority component.
Where two applications have the same priority, the process that has been at a lower priority longest will be killed first. Process priority is also affected by interprocess dependencies; if an application has a dependency on a Service or Content Provider supplied by a second application, the secondary application will have at least as high a priority as the application it supports.
All Android applications will remain running and in memory until the system needs its resources for other applications.
The following list details each of the application states shown in Figure , explaining how the state is determined by the application components comprising it:
Active Processes Active (foreground) processes are those hosting applications with components currently interacting with the user. These are the processes Android is trying to keep responsive by reclaiming resources. There are generally very few of these processes, and they will be killed only as a last resort.
Active processes include:
- Activities in an “active” state; that is, they are in the foreground and responding to user events. You will explore Activity states in greater detail later in this chapter.
- Activities, Services, or Broadcast Receivers that are currently executing an onReceive event handler.
- Services that are executing an onStart, onCreate, or onDestroy event handler.
Visible Processes Visible, but inactive processes are those hosting “visible” Activities. As the name suggests, visible Activities are visible, but they aren’t in the foreground or responding to user events. This happens when an Activity is only partially obscured (by a non-full-screen or transparent Activity). There are generally very few visible processes, and they’ll only be killed in extreme circumstances to allow active processes to continue.
Started Service Processes Processes hosting Services that have been started. Services support ongoing processing that should continue without a visible interface. Because Services don’t interact directly with the user, they receive a slightly lower priority than visible Activities. They are still considered to be foreground processes and won’t be killed unless resources are needed for active or visible processes.
Background Processes Processes hosting Activities that aren’t visible and that don’t have any Services that have been started are considered background processes. There will generally be a large number of background processes that Android will kill using a last-seen-first-killed pat- tern to obtain resources for foreground processes.
Empty Processes To improve overall system performance, Android often retains applications in memory after they have reached the end of their lifetimes. Android maintains this cache to improve the start-up time of applications when they’re re-launched. These processes are rou- tinely killed as required.
How to use memory efficiently
Android manages opened applications which are running in the background, so officially you shouldn’t care about that. This means that it closes the applications when the system needs more memory. However, most android users are not very satisfied with how it does its things because sometimes it leaves too many processes running which causes sluggishness’ in everyday performance. We can use advanced task killer/task manager and it does its job very well.
I think, Now you might be clear the memory concept of android. I will come soon with tracking the memory allocation and avoiding the memory leaks.
Memory Reallocation of the Android OS - Android Forums
Jul 07, 2010 @ 08:15:36
here is why I use a task killer - Android Forums
Jul 07, 2010 @ 08:37:27
Raynessia
Oct 06, 2010 @ 04:25:25
Hi, I am a college Computer Information Systems major currently enrolled in an operating system course. I am doing a paper on the Android Mobile Phone Operating System, but up to now I have had some trouble finding information on the OS Design goals, memory, processes, device, file, network and security Management. Could I get some of this information from you or could you point me in the right direction as to where to look?
Thank you for your time.
mamvee
Oct 06, 2010 @ 15:43:01
I am doing a research work on the Android Operating System, and I have also the same problem in finding information about this operating system. (Process Management, Storage management, Protection and Security, I/O System.)
Please help me. Thank’s Much.. 🙂
Trajche
Dec 01, 2010 @ 20:44:28
Same problem. I gave to do some seminar work about Andorid OS, but couldn’t find information.
…F1 (helo):)
Sanket Patle
Dec 31, 2010 @ 02:13:44
Thanks for the details. Any idea where I can get details about all aspects of android OS (memory, process, thead, io management)?
Android
Jan 05, 2011 @ 08:45:25
Fine app for android thanks for the tip I am already experimenting in my android and perfect
a work in very nice.
Probleme mit RAM - Android-Hilfe.de
Jan 15, 2011 @ 22:16:24
BlackBerry vs Android « My View
Feb 09, 2011 @ 09:28:09
jhoravi
Feb 26, 2011 @ 23:08:22
Does Android use some kind of virtual memory from the flash storage to swap background apps?
mobworld
Mar 02, 2011 @ 19:32:12
I think, Android uses Virtual memory from SD card to allow swapping between applications. I am not sure if this truly happens.
You can check this article to find out more:
Manajemen proses dan memory di android « Muhammad Al Mahdi
Mar 23, 2011 @ 09:20:48
KONSEP PROSES ANDROID « TASKER
Mar 28, 2011 @ 14:58:32
Vishwanath m
Mar 31, 2011 @ 10:54:19
Hi.am an android application developer from Bangalore-India.your article for Memory Management in Android is very good..
Perbandingan BlackBerry vs Android « M. Eko Agus Y.
May 02, 2011 @ 19:23:37
Android Kalahkan Balckberry « Psi4success’s Weblog
May 31, 2011 @ 11:29:13
Android VS Blackberry « agixdota
Jul 09, 2011 @ 18:08:48
BlackBerry oh BlackBerry « Lumongga Anandita
Aug 03, 2011 @ 14:11:43
ANDROID VS BLACKBERRY « vjmike
Aug 24, 2011 @ 18:27:59
Android memóriakezelés | ArnoldWEBlog
Sep 26, 2011 @ 23:31:54
General jerks over @ another forum won't answer my ? - Android Forums
Oct 24, 2011 @ 22:05:34
Android OS « Sean Sovine
Nov 03, 2011 @ 19:50:06
Kirivarnan
Nov 10, 2011 @ 12:29:19
very good article ..
AW Blog » Blog Archive » Perbandingan BlackBerry vs Android
Dec 19, 2011 @ 13:42:31
BlackBerry vs Android « allaboutsyarif
Dec 21, 2011 @ 13:58:02
» Ersin YILDIZ
Dec 25, 2011 @ 16:44:08
Anonymous
Jan 10, 2012 @ 23:49:13
urban127
Jan 15, 2012 @ 23:26:53
hi @mobworld
Your article is one of the few on the net that actually go in-depth on this topic…Any suggestions on where to look if i need to learn more about the android kernel?
Perbandingan Bl… | aldiansyah
Mar 13, 2012 @ 20:20:06