SlideShare a Scribd company logo
1 of 24
Download to read offline
Android internals
     Egor Elizarov
     SPbSU 2012
Legal info
   Android internals by Egor Elizarov is licensed under a
    Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License

   You are free to
      – copy, distribute, display, and perform the work
      – make derivative works
   Under the following conditions
       – Attribution. You must give the original author credit
       – Share Alike. If you alter, transform, or build upon this work, you may
         distribute the resulting work only under a license identical to this one
   All pictures and trademarks are the property of their respective owners. Use of
    these trademarks and pictures is subject to owners permissions.
   Corrections, suggestions, contributions and translations are welcome!



                                          2                                 Egor Elizarov SPbSU 2012
Lecture 5




                           Dalvik VM



                                        yegor.yelizarov(at)gmail.com
Rev: 1.1
Last update: 05/30/2012                http://vk.com/android_internals


                               3                        Egor Elizarov SPbSU 2012
Previous time

    Vanilla

    Kernel types

    Android/Kernel interaction

    “Androdized” kernel features

    Bionic

    Log system

                           4       Egor Elizarov SPbSU 2012
Virtual Machines


    VM concept was introduced in 1960s in
    Cambridge

    Defined by Popek & Goldberg in 1973 as "an
    efficient, isolated duplicate of a real machine"

    System VM (Whole OS emulation)

    Process VM (One program emulation)

                            5                    Egor Elizarov SPbSU 2012
Virtualization approaches



    Paravirtualization

    Full virtualization

    HW assisted virtualization




                          6      Egor Elizarov SPbSU 2012
Process VM types

         Register VM                           Stack VM

     Limited number of
    registers with addresses
                                   
                                       Stack


    State register
                                   
                                       Reverse Polish notation


    List of instructions
                                   
                                       Load/Store



                               7                       Egor Elizarov SPbSU 2012
Dalvik VM


    Register based

    Designed for low memory requirements

    Relying on OS
      – Memory management
      – Thread support
      –   Process isolation


                              8            Egor Elizarov SPbSU 2012
Dalvik VM (2)



    Allow multiple VM instances to run once

    Supports Java Debug Wire Protocol

    Based on Apache Harmony (Open Source Java)




                         9                    Egor Elizarov SPbSU 2012
Dalvik bytecode


    Quite similar to common real architectures

    Fixed size frames with particular number of
    registers (one per method)

    32-bit registers

    Reach meta information for each method


                          10                     Egor Elizarov SPbSU 2012
Dalvik bytecode example




           11         Egor Elizarov SPbSU 2012
ARM ASM example




       12         Egor Elizarov SPbSU 2012
Interpreter core



    Portable (C)

    Fast (C + ASM)

    JIT (C + ASM + JIT)

    Debug (C + ASM + profiling & single stepping)



                          13                 Egor Elizarov SPbSU 2012
Just-In-Time




Source: http://dl.google.com/googleio/2010/android-jit-compiler-androids-dalvik-vm.pdf



                                     14                                                  Egor Elizarov SPbSU 2012
Android application


    No single entry point

    Activities, Services, Broadcast Receivers,
    Content Providers

    Intents

    New VM instance (Copy on write)


                            15                   Egor Elizarov SPbSU 2012
Dalvik EXecutable




Source: http://stid.googlecode.com/files/2008-05-29-Presentation-Of-Dalvik-VM-Internals.pdf

                                            16                                                Egor Elizarov SPbSU 2012
Zygote



    Nascent VM process

    Starts at boot time

    Preloads and preinitializes classes

    fork()s on command



                           17             Egor Elizarov SPbSU 2012
Java application caching




           18              Egor Elizarov SPbSU 2012
Java application launching




     Source: http://coltf.blogspot.com/p/android-os-processes-and-zygote.html



                                        19                                      Egor Elizarov SPbSU 2012
Dalvik porting


    Core libraries should work from scratch

    Implement JNI call bridge

    Use portable interpreter

    Replace opcode stubs

    Use debug execution mode for debugging


                           20                 Egor Elizarov SPbSU 2012
Next Time




    Android IPC

    Typical Android
    subsystem




                      21      Egor Elizarov SPbSU 2012
Useful links


    http://vk.com/android_internals

    K.Sutner. Register Machines. Carnegie Mellon University. Fall 2011
    URL: http://www.cs.cmu.edu/~cdm/pdf/RegisterMach-6up.pdf

    M.Schoeberl. Design and implementation of an Effective Stack
    Machine. Viena, Austria. URL:
    http://ti.tuwien.ac.at/rts/people/schoeberl/publications/stack.pdf

    Y. Shi, D. Gregg, A. Beatty, M. A. Ertl. Virtual Machine Showdown:
    Stack Versus Registers. Dublin, Viena. URL:
    http://static.usenix.org/events/vee05/full_papers/p153-yunhe.pdf

    http://www.dalvikvm.com/



                                      22                             Egor Elizarov SPbSU 2012
Useful links (2)


    http://pallergabor.uw.hu/common/understandingdalvikbytecode.pdf

    $ANDROID_ROOT/dalvik/docs/

    http://s.android.com/tech/dalvik/dalvik-bytecode.html

    D. Bornstein. Dalvik VM Internals. 2008 URL:
    http://stid.googlecode.com/files/2008-05-29-Presentation-Of-Dalvik-
    VM-Internals.pdf

    http://coltf.blogspot.com/p/android-os-processes-and-zygote.html

    http://www.google.com/events/io/2010/sessions/jit-compiler-
    androids-dalvik-vm.html



                                    23                            Egor Elizarov SPbSU 2012
Thanks to


    Sergey Matyukevich for review and advices
    (www.linkedin.com/pub/sergey-matyukevich/31/889/769)


    Nikolay F. Fominykh for review and advices


    Nikita Shulga for advices and notes
    (http://www.linkedin.com/pub/nikita-shulga/8/582/287)


    Grigory Tolstolytkin for advices and notes
    (http://www.linkedin.com/pub/grigory-
    tolstolytkin/2a/b41/74)


                                24                      Egor Elizarov SPbSU 2012

More Related Content

What's hot

Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Egor Elizarov
 
Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Egor Elizarov
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting SequenceJayanta Ghoshal
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 

What's hot (6)

Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)Android internals 00 - Introduction (rev_1.1)
Android internals 00 - Introduction (rev_1.1)
 
Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting Sequence
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 

Viewers also liked

Let's talk about jni
Let's talk about jniLet's talk about jni
Let's talk about jniYongqiang Li
 
LinkedIn - Disassembling Dalvik Bytecode
LinkedIn - Disassembling Dalvik BytecodeLinkedIn - Disassembling Dalvik Bytecode
LinkedIn - Disassembling Dalvik BytecodeAlain Leon
 
Understanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolUnderstanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolGabor Paller
 
Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)ClubHack
 
Reverse engineering android apps
Reverse engineering android appsReverse engineering android apps
Reverse engineering android appsPranay Airan
 
Reverse Engineering .NET and Java
Reverse Engineering .NET and JavaReverse Engineering .NET and Java
Reverse Engineering .NET and JavaJoe Kuemerle
 
Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeMário Almeida
 
How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...Christoph Matthies
 
Garbage Collection of Java VM
Garbage Collection of Java VMGarbage Collection of Java VM
Garbage Collection of Java VMYongqiang Li
 

Viewers also liked (17)

Understanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual MachineUnderstanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual Machine
 
Let's talk about jni
Let's talk about jniLet's talk about jni
Let's talk about jni
 
LinkedIn - Disassembling Dalvik Bytecode
LinkedIn - Disassembling Dalvik BytecodeLinkedIn - Disassembling Dalvik Bytecode
LinkedIn - Disassembling Dalvik Bytecode
 
Understanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer toolUnderstanding the Dalvik bytecode with the Dedexer tool
Understanding the Dalvik bytecode with the Dedexer tool
 
Dancing with dalvik
Dancing with dalvikDancing with dalvik
Dancing with dalvik
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)Hacking your Droid (Aditya Gupta)
Hacking your Droid (Aditya Gupta)
 
Smali语法
Smali语法Smali语法
Smali语法
 
Reverse engineering android apps
Reverse engineering android appsReverse engineering android apps
Reverse engineering android apps
 
Toward Reverse Engineering of VBA Based Excel Spreadsheets Applications
Toward Reverse Engineering of VBA Based Excel Spreadsheets ApplicationsToward Reverse Engineering of VBA Based Excel Spreadsheets Applications
Toward Reverse Engineering of VBA Based Excel Spreadsheets Applications
 
Reverse Engineering Android Application
Reverse Engineering Android ApplicationReverse Engineering Android Application
Reverse Engineering Android Application
 
Reverse Engineering .NET and Java
Reverse Engineering .NET and JavaReverse Engineering .NET and Java
Reverse Engineering .NET and Java
 
Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skype
 
Android JNI
Android JNIAndroid JNI
Android JNI
 
Game controlling via android
Game controlling via androidGame controlling via android
Game controlling via android
 
How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...
 
Garbage Collection of Java VM
Garbage Collection of Java VMGarbage Collection of Java VM
Garbage Collection of Java VM
 

Similar to Android internals 05 - Dalvik VM (rev_1.1)

IEEE Day 2013 Baku - Spring Framework overview and Spring MVC
IEEE Day 2013 Baku - Spring Framework overview and Spring MVCIEEE Day 2013 Baku - Spring Framework overview and Spring MVC
IEEE Day 2013 Baku - Spring Framework overview and Spring MVCIlkin Ashrafli
 
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...Paris Open Source Summit
 
Zero redeployment with JRebel
Zero redeployment with JRebelZero redeployment with JRebel
Zero redeployment with JRebelMinh Hoang
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Saeed Zarinfam
 
Java Applications with Visual Studio
Java Applications with Visual StudioJava Applications with Visual Studio
Java Applications with Visual StudioRed Hat Developers
 
ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례Anson Park
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Makmfrancis
 
An introduction to the Spring Framework
An introduction to the Spring FrameworkAn introduction to the Spring Framework
An introduction to the Spring Frameworkweili_at_slideshare
 
Webgl 기술동향 2011.8
Webgl 기술동향 2011.8Webgl 기술동향 2011.8
Webgl 기술동향 2011.8Seung Joon Choi
 
Readactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory DisclosureReadactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory Disclosurech0psticks
 
Migration from AngularJS to Angular
Migration from AngularJS to AngularMigration from AngularJS to Angular
Migration from AngularJS to AngularAleks Zinevych
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCFunnelll
 
Comparison Of Open Source App Servers
Comparison Of Open Source App ServersComparison Of Open Source App Servers
Comparison Of Open Source App ServersRogue Wave Software
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Vadym Kazulkin
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And BeyondVMware Tanzu
 

Similar to Android internals 05 - Dalvik VM (rev_1.1) (20)

IEEE Day 2013 Baku - Spring Framework overview and Spring MVC
IEEE Day 2013 Baku - Spring Framework overview and Spring MVCIEEE Day 2013 Baku - Spring Framework overview and Spring MVC
IEEE Day 2013 Baku - Spring Framework overview and Spring MVC
 
Ah java-ppt1
Ah java-ppt1Ah java-ppt1
Ah java-ppt1
 
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
 
Zero redeployment with JRebel
Zero redeployment with JRebelZero redeployment with JRebel
Zero redeployment with JRebel
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)
 
Java Applications with Visual Studio
Java Applications with Visual StudioJava Applications with Visual Studio
Java Applications with Visual Studio
 
ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례ELB를 활용한 Socket.IO 멀티노드 구축사례
ELB를 활용한 Socket.IO 멀티노드 구축사례
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Mak
 
An introduction to the Spring Framework
An introduction to the Spring FrameworkAn introduction to the Spring Framework
An introduction to the Spring Framework
 
Webgl 기술동향 2011.8
Webgl 기술동향 2011.8Webgl 기술동향 2011.8
Webgl 기술동향 2011.8
 
Readactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory DisclosureReadactor-Practical Code Randomization Resilient to Memory Disclosure
Readactor-Practical Code Randomization Resilient to Memory Disclosure
 
Migration from AngularJS to Angular
Migration from AngularJS to AngularMigration from AngularJS to Angular
Migration from AngularJS to Angular
 
Sadiq786
Sadiq786Sadiq786
Sadiq786
 
Mono for Android?
Mono for Android?Mono for Android?
Mono for Android?
 
Introduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoCIntroduction to Spring Framework and Spring IoC
Introduction to Spring Framework and Spring IoC
 
[Csc102 hw1] 5502 ks
[Csc102 hw1] 5502 ks[Csc102 hw1] 5502 ks
[Csc102 hw1] 5502 ks
 
OSGi overview
OSGi overviewOSGi overview
OSGi overview
 
Comparison Of Open Source App Servers
Comparison Of Open Source App ServersComparison Of Open Source App Servers
Comparison Of Open Source App Servers
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 

Android internals 05 - Dalvik VM (rev_1.1)

  • 1. Android internals Egor Elizarov SPbSU 2012
  • 2. Legal info  Android internals by Egor Elizarov is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License  You are free to – copy, distribute, display, and perform the work – make derivative works  Under the following conditions – Attribution. You must give the original author credit – Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one  All pictures and trademarks are the property of their respective owners. Use of these trademarks and pictures is subject to owners permissions.  Corrections, suggestions, contributions and translations are welcome! 2 Egor Elizarov SPbSU 2012
  • 3. Lecture 5 Dalvik VM yegor.yelizarov(at)gmail.com Rev: 1.1 Last update: 05/30/2012 http://vk.com/android_internals 3 Egor Elizarov SPbSU 2012
  • 4. Previous time  Vanilla  Kernel types  Android/Kernel interaction  “Androdized” kernel features  Bionic  Log system 4 Egor Elizarov SPbSU 2012
  • 5. Virtual Machines  VM concept was introduced in 1960s in Cambridge  Defined by Popek & Goldberg in 1973 as "an efficient, isolated duplicate of a real machine"  System VM (Whole OS emulation)  Process VM (One program emulation) 5 Egor Elizarov SPbSU 2012
  • 6. Virtualization approaches  Paravirtualization  Full virtualization  HW assisted virtualization 6 Egor Elizarov SPbSU 2012
  • 7. Process VM types Register VM Stack VM  Limited number of registers with addresses  Stack  State register  Reverse Polish notation  List of instructions  Load/Store 7 Egor Elizarov SPbSU 2012
  • 8. Dalvik VM  Register based  Designed for low memory requirements  Relying on OS – Memory management – Thread support – Process isolation 8 Egor Elizarov SPbSU 2012
  • 9. Dalvik VM (2)  Allow multiple VM instances to run once  Supports Java Debug Wire Protocol  Based on Apache Harmony (Open Source Java) 9 Egor Elizarov SPbSU 2012
  • 10. Dalvik bytecode  Quite similar to common real architectures  Fixed size frames with particular number of registers (one per method)  32-bit registers  Reach meta information for each method 10 Egor Elizarov SPbSU 2012
  • 11. Dalvik bytecode example 11 Egor Elizarov SPbSU 2012
  • 12. ARM ASM example 12 Egor Elizarov SPbSU 2012
  • 13. Interpreter core  Portable (C)  Fast (C + ASM)  JIT (C + ASM + JIT)  Debug (C + ASM + profiling & single stepping) 13 Egor Elizarov SPbSU 2012
  • 15. Android application  No single entry point  Activities, Services, Broadcast Receivers, Content Providers  Intents  New VM instance (Copy on write) 15 Egor Elizarov SPbSU 2012
  • 17. Zygote  Nascent VM process  Starts at boot time  Preloads and preinitializes classes  fork()s on command 17 Egor Elizarov SPbSU 2012
  • 18. Java application caching 18 Egor Elizarov SPbSU 2012
  • 19. Java application launching Source: http://coltf.blogspot.com/p/android-os-processes-and-zygote.html 19 Egor Elizarov SPbSU 2012
  • 20. Dalvik porting  Core libraries should work from scratch  Implement JNI call bridge  Use portable interpreter  Replace opcode stubs  Use debug execution mode for debugging 20 Egor Elizarov SPbSU 2012
  • 21. Next Time  Android IPC  Typical Android subsystem 21 Egor Elizarov SPbSU 2012
  • 22. Useful links  http://vk.com/android_internals  K.Sutner. Register Machines. Carnegie Mellon University. Fall 2011 URL: http://www.cs.cmu.edu/~cdm/pdf/RegisterMach-6up.pdf  M.Schoeberl. Design and implementation of an Effective Stack Machine. Viena, Austria. URL: http://ti.tuwien.ac.at/rts/people/schoeberl/publications/stack.pdf  Y. Shi, D. Gregg, A. Beatty, M. A. Ertl. Virtual Machine Showdown: Stack Versus Registers. Dublin, Viena. URL: http://static.usenix.org/events/vee05/full_papers/p153-yunhe.pdf  http://www.dalvikvm.com/ 22 Egor Elizarov SPbSU 2012
  • 23. Useful links (2)  http://pallergabor.uw.hu/common/understandingdalvikbytecode.pdf  $ANDROID_ROOT/dalvik/docs/  http://s.android.com/tech/dalvik/dalvik-bytecode.html  D. Bornstein. Dalvik VM Internals. 2008 URL: http://stid.googlecode.com/files/2008-05-29-Presentation-Of-Dalvik- VM-Internals.pdf  http://coltf.blogspot.com/p/android-os-processes-and-zygote.html  http://www.google.com/events/io/2010/sessions/jit-compiler- androids-dalvik-vm.html 23 Egor Elizarov SPbSU 2012
  • 24. Thanks to  Sergey Matyukevich for review and advices (www.linkedin.com/pub/sergey-matyukevich/31/889/769)  Nikolay F. Fominykh for review and advices  Nikita Shulga for advices and notes (http://www.linkedin.com/pub/nikita-shulga/8/582/287)  Grigory Tolstolytkin for advices and notes (http://www.linkedin.com/pub/grigory- tolstolytkin/2a/b41/74) 24 Egor Elizarov SPbSU 2012