We need to modify the existing Java virtual machine for the mobile platform because of low battery power, low processing power and it needs to run on less processor power and less and limited resources when compared with the personal computer.
JVM was modified for Android OS of power management, binding, an earlier version of the android named it Dalvik. Java source code is get compiled with java bytecode and by using Dex compiler java bytecode is get compiled into Dalvik bytecode.
Dalvik bytecode is optimized code as compared with Java bytecode, it takes less memory to run and is suitable for the embedded devices where we have limited memory and processing power. All applications written in Java are converted into the Dalvik executable .dex and every android app runs its own process with its own instance of Dalvik virtual machine which provides security.
Android kernel was improved the binding and power management features than Linux. Android power management is built on top of standard Linux power management and supports more aggressive power management. Power management supports several types of “Wake Locks”, applications make requests to keep the power through “Wake Locks” and if there are no active wake locks then CPU will be turn off and if there are partial wake locks then screen and keyboard will be turned off as shown below
There are several types of wake locks
Android uses native OS C libraries but some libraries are not used or modified for example glib c library. Android uses paging and Memory Mapping(mmapping) to manage memory and it does not support swapping as we have in Windows and Linux environments. Memory mapping is used to map image and data files into process address space. Garbage collection is done by using Mark Sweep Algorithm.
App Switching Mechanism:
When a user launches the app a process is created and when the user leaves the app process is not quit, the system keeps the cached, so if the user later returns to the app the process is reused for faster app switching.
Active process have critical priority and background and empty process have low priority and OS detects the processes which are not used for many days and suggest to the user to close the app so space can be free and resources can be released. Visible process and started services process have high priority.