SlideShare a Scribd company logo
1 of 29
1. INTRODUCTION 
2. ARCHITECTURE 
3. Dalvik Virtual Machine(DVM) 
4. Process Management 
5. Memory Management 
6. Application and Service Lifecycle
 Android is Mobile(Device) Based OS. 
 Which is based on Linux 2.6 kernel. 
 Android Inc.(founded in 2003 and is based in Palo Alto, 
California) which operated as subsidiary of Google and later 
purchased by Google in 2005. 
 OHA Est. 5th Nov 2007, led by Google, open Source. 
 Open source under the Apache 2 license. 
 Android was publicly announced in 2007 and first phone was 
sold on October 2008. 
 HTC was First to deliver ANDROID Mobile Device.
• Linux kernel 
• Libraries 
• Android run time 
– core libraries 
– Dalvik virtual machine 
• Application layer 
• Application protocol
 Acts as an abstraction layer between the hardware and the 
rest of the software stack. 
 Relies on Linux version 2.6 for core system services such as 
security, memory management, process management, 
network stack, and driver model. 
 Works as a HAL (Hardware Abstraction Layer or 
rather Hardware Annotation Library)
 System C library - implementation of the C library (libc). 
 Media Libraries - based on PacketVideo's Open CORE. 
 Surface Manager - composites 2D and 3D graphic layers 
 LibWebCore - a modern embeddable web view. 
 SGL - the underlying 2D graphics engine. 
 3D libraries - based on OpenGL ES 1.0 APIs; the libraries use 
hardware 3D acceleration. 
 FreeType - bitmap and vector font rendering 
 SQLite - a powerful and lightweight relational database 
engine .
 Includes a set of core libraries of JAVA that provides most of 
the functionality 
 Runs in its own process, with its own instance of the Dalvik 
Virtual Machine 
 The Dalvik VM executes files in the Dvbalvik Executable 
(.dex) 
 Compact and efficient than class files 
 Limited memory and battery power
 Access location information, run background services, set 
alarms, add notifications to the status bar, and much, much 
more. 
 Build an application, including lists, grids, text boxes, 
buttons, and even an embeddable web browser 
 Providing access to non-code resources such as localized 
strings, graphics, and layout files. 
 Activity manager manages application life cycle. 
 Content provider Enable applications access data from 
other applications.
 resource manager which gives us access to non court 
resources such as localized strings or various others, we can 
layout so many resources, we can have in the form of PNG, 
BMP as well as XML so resource manager helps us to get 
access to those non code resources. 
 Notification manager which helps us to display custom 
alerts on status bar. 
 location managers it handles information about the location. 
 telephony manager which handles information about telephony.
POP 20 
POP 7 
ADD 20, 7, result 
PUSH result 
Stack Based 
Virtual Machine(ex.JVM)
Register Based 
Virtual Machine(ex.DVM) 
Add R3,R1,R2
 A special Java Virtual Machine(VM) designed 
to run with limited system resource. 
 It is basically a virtual machine for embedded 
devices, which like any other virtual machine, 
is a byte code interpreter. 
 it means it is low on memory, comparatively 
slower and runs on battery power. 
 Google is modify DVM according to the 
Android OS is named as Dalvik Turbo 
virtual machine. 
 Java class file are converted into “.dex” Files 
that Dalvik executes 
 Java byte code is converted into Dalvik byte-code 
during this process
 For each application android creates a new process with 
single thread of execution(i.e. main thread) 
 By default all the components run in same thread(main 
thread) If not developer explicitly creates a new thread. 
 In low memory situations a process is decide to kill based 
upon the number of inactive components of that 
process. 
 A process which have more number of inactive components 
should be killed first.
 A process is treated as foreground if any of components 
of process holds following states. 
 An activity which is interacting with user. When an 
activity calls methods like onstart(), onresume(). 
 When a service is interacting with foreground activity. 
 When a service is started using startForeground(). 
 when a service is executing any of the methods like 
onCreate(),onStart(), onDestroy().
 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. 
 An activity which is not interacting with user. But it is 
still visible to user, when an activity running method like 
onPause().
 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. 
 When a service is started using startService(). 
 Eg: playing music in background, downloading file from 
internet.
 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 
pattern to obtain resources for foreground 
processes. 
 When an activity running method like onStop(). 
i.e currently user is not interacting with that activity. 
 Whenever a process decided to kill, it stores the state of 
activity. So whenever next time user wants that activity, 
we can restore the previous state of activity.
 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 routinely killed as required. 
 When a process does not have any active component. 
 Caching of empty process inside memory, reduces 
relaunching of application once again if user wants that 
application in future.
 Page-based memory management 
 Virtual address to physical address mapping 
 No virtual memory
 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 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 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 inter-process 
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.
 Application run in their own processes (VM, PID) 
 Processes are started and stopped as needed to run an 
application's components 
 Processes may be killed to reclaim resources
Thank You

More Related Content

Similar to Android OS

Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1Kainda Kiniel Daka
 
OS in mobile devices [Android]
OS in mobile devices [Android]OS in mobile devices [Android]
OS in mobile devices [Android]Yatharth Aggarwal
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32Eden Shochat
 
Android vs ios System Architecture in OS perspective
Android vs ios System Architecture in OS perspectiveAndroid vs ios System Architecture in OS perspective
Android vs ios System Architecture in OS perspectiveRaj Pratim Bhattacharya
 
Android- Introduction for Beginners
Android- Introduction for BeginnersAndroid- Introduction for Beginners
Android- Introduction for BeginnersTripti Tiwari
 
Android training course
Android training courseAndroid training course
Android training courseAdarsh Pandey
 
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...Padma shree. T
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A NutshellTed Chien
 
Android overview
Android overviewAndroid overview
Android overviewHas Taiar
 
First Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionFirst Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionCesar Augusto Nogueira
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App DevelopmentMike Kvintus
 

Similar to Android OS (20)

Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1
 
Android
AndroidAndroid
Android
 
Android Memory Management
Android Memory ManagementAndroid Memory Management
Android Memory Management
 
OS in mobile devices [Android]
OS in mobile devices [Android]OS in mobile devices [Android]
OS in mobile devices [Android]
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
 
Android platform
Android platform Android platform
Android platform
 
Android vs ios System Architecture in OS perspective
Android vs ios System Architecture in OS perspectiveAndroid vs ios System Architecture in OS perspective
Android vs ios System Architecture in OS perspective
 
Android OS
Android OSAndroid OS
Android OS
 
Android- Introduction for Beginners
Android- Introduction for BeginnersAndroid- Introduction for Beginners
Android- Introduction for Beginners
 
Android Anatomy
Android  AnatomyAndroid  Anatomy
Android Anatomy
 
Android training course
Android training courseAndroid training course
Android training course
 
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...
ACADGILD:: ANDROID LESSON-How to analyze & manage memory on android like ...
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
Android overview
Android overviewAndroid overview
Android overview
 
Android my
Android myAndroid my
Android my
 
GMR PROJECT PPT
GMR PROJECT PPTGMR PROJECT PPT
GMR PROJECT PPT
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
First Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionFirst Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting Introduction
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
 

Recently uploaded

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

Android OS

  • 1.
  • 2. 1. INTRODUCTION 2. ARCHITECTURE 3. Dalvik Virtual Machine(DVM) 4. Process Management 5. Memory Management 6. Application and Service Lifecycle
  • 3.  Android is Mobile(Device) Based OS.  Which is based on Linux 2.6 kernel.  Android Inc.(founded in 2003 and is based in Palo Alto, California) which operated as subsidiary of Google and later purchased by Google in 2005.  OHA Est. 5th Nov 2007, led by Google, open Source.  Open source under the Apache 2 license.  Android was publicly announced in 2007 and first phone was sold on October 2008.  HTC was First to deliver ANDROID Mobile Device.
  • 4.
  • 5. • Linux kernel • Libraries • Android run time – core libraries – Dalvik virtual machine • Application layer • Application protocol
  • 6.
  • 7.  Acts as an abstraction layer between the hardware and the rest of the software stack.  Relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model.  Works as a HAL (Hardware Abstraction Layer or rather Hardware Annotation Library)
  • 8.  System C library - implementation of the C library (libc).  Media Libraries - based on PacketVideo's Open CORE.  Surface Manager - composites 2D and 3D graphic layers  LibWebCore - a modern embeddable web view.  SGL - the underlying 2D graphics engine.  3D libraries - based on OpenGL ES 1.0 APIs; the libraries use hardware 3D acceleration.  FreeType - bitmap and vector font rendering  SQLite - a powerful and lightweight relational database engine .
  • 9.  Includes a set of core libraries of JAVA that provides most of the functionality  Runs in its own process, with its own instance of the Dalvik Virtual Machine  The Dalvik VM executes files in the Dvbalvik Executable (.dex)  Compact and efficient than class files  Limited memory and battery power
  • 10.  Access location information, run background services, set alarms, add notifications to the status bar, and much, much more.  Build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser  Providing access to non-code resources such as localized strings, graphics, and layout files.  Activity manager manages application life cycle.  Content provider Enable applications access data from other applications.
  • 11.  resource manager which gives us access to non court resources such as localized strings or various others, we can layout so many resources, we can have in the form of PNG, BMP as well as XML so resource manager helps us to get access to those non code resources.  Notification manager which helps us to display custom alerts on status bar.  location managers it handles information about the location.  telephony manager which handles information about telephony.
  • 12.
  • 13.
  • 14. POP 20 POP 7 ADD 20, 7, result PUSH result Stack Based Virtual Machine(ex.JVM)
  • 15. Register Based Virtual Machine(ex.DVM) Add R3,R1,R2
  • 16.  A special Java Virtual Machine(VM) designed to run with limited system resource.  It is basically a virtual machine for embedded devices, which like any other virtual machine, is a byte code interpreter.  it means it is low on memory, comparatively slower and runs on battery power.  Google is modify DVM according to the Android OS is named as Dalvik Turbo virtual machine.  Java class file are converted into “.dex” Files that Dalvik executes  Java byte code is converted into Dalvik byte-code during this process
  • 17.  For each application android creates a new process with single thread of execution(i.e. main thread)  By default all the components run in same thread(main thread) If not developer explicitly creates a new thread.  In low memory situations a process is decide to kill based upon the number of inactive components of that process.  A process which have more number of inactive components should be killed first.
  • 18.  A process is treated as foreground if any of components of process holds following states.  An activity which is interacting with user. When an activity calls methods like onstart(), onresume().  When a service is interacting with foreground activity.  When a service is started using startForeground().  when a service is executing any of the methods like onCreate(),onStart(), onDestroy().
  • 19.  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.  An activity which is not interacting with user. But it is still visible to user, when an activity running method like onPause().
  • 20.  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.  When a service is started using startService().  Eg: playing music in background, downloading file from internet.
  • 21.  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 pattern to obtain resources for foreground processes.  When an activity running method like onStop(). i.e currently user is not interacting with that activity.  Whenever a process decided to kill, it stores the state of activity. So whenever next time user wants that activity, we can restore the previous state of activity.
  • 22.  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 routinely killed as required.  When a process does not have any active component.  Caching of empty process inside memory, reduces relaunching of application once again if user wants that application in future.
  • 23.  Page-based memory management  Virtual address to physical address mapping  No virtual memory
  • 24.  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 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.
  • 25.  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 inter-process 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.
  • 26.  Application run in their own processes (VM, PID)  Processes are started and stopped as needed to run an application's components  Processes may be killed to reclaim resources
  • 27.
  • 28.

Editor's Notes

  1. Activity Manager :Manages the lifecycle of applications Content provider : Enable applications access data from other applications Resource Manager : Providing access to non-code resources Window Manager Notification manager SQLite Databases: relational database library for storing and managing complex data Files: you can create, write, and read files from the local storage or external media (SD Cards) FileOutputStream, FileInputStream, and Resources classes. ======================================================= Set of core applications including an email client, SMS program, calendar, maps, browser, contacts. All applications are written using the Java programming language. Built in and user apps. Can replace built in apps.
  2. Activity Manager :Manages the lifecycle of applications Content provider : Enable applications access data from other applications Resource Manager : Providing access to non-code resources Window Manager Notification manager SQLite Databases: relational database library for storing and managing complex data Files: you can create, write, and read files from the local storage or external media (SD Cards) FileOutputStream, FileInputStream, and Resources classes. ======================================================= Set of core applications including an email client, SMS program, calendar, maps, browser, contacts. All applications are written using the Java programming language. Built in and user apps. Can replace built in apps.
  3. Activity Manager :Manages the lifecycle of applications Content provider : Enable applications access data from other applications Resource Manager : Providing access to non-code resources Window Manager Notification manager SQLite Databases: relational database library for storing and managing complex data Files: you can create, write, and read files from the local storage or external media (SD Cards) FileOutputStream, FileInputStream, and Resources classes. ======================================================= Set of core applications including an email client, SMS program, calendar, maps, browser, contacts. All applications are written using the Java programming language. Built in and user apps. Can replace built in apps.
  4. A stack based virtual machine implements the general features described as needed by a virtual machine in the points above, but the memory structure where the operands are stored is a stack data structure. Operations are carried out by popping data from the stack, processing them and pushing in back the results in LIFO (Last in First Out) fashion. In a stack based virtual machine, the operation of adding two numbers would usually be carried out in the following manner (where 20, 7, and ‘result’ are the operands): Because of the PUSH and POP operations, four lines of instructions is needed to carry out an addition operation. An advantage of the stack based model is that the operands are addressed implicitly by the stack pointer (SP in above image). This means that the Virtual machine does not need to know the operand addresses explicitly, as calling the stack pointer will give (Pop) the next operand. In stack based VM’s, all the arithmetic and logic operations are carried out via Pushing and Popping the operands and results in the stack.
  5. As I mentioned earlier, there is no POP or PUSH operations, so the instruction for adding is just one line. But unlike the stack, we need to explicitly mention the addresses of the operands as R1, R2, and R3. The advantage here is that the overhead of pushing to and popping from a stack is non-existent, and instructions in a register based VM execute faster within the instruction dispatch loop. Another advantage of the register based model is that it allows for some optimizations that cannot be done in the stack based approach. One such instance is when there are common sub expressions in the code, the register model can calculate it once and store the result in a register for future use when the sub expression comes up again, which reduces the cost of recalculating the expression. The problem with a register based model is that the average register instruction is larger than an average stack instruction, as we need to specify the operand addresses explicitly. Whereas the instructions for a stack machine is short due to the stack pointer, the respective register machine instructions need to contain operand locations, and results in larger register code compared to stack code.
  6. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimised for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included “dx” tool. Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language.