The Android bootup process begins with the boot ROM code loading the first stage boot loader into RAM. The first stage boot loader then loads the main boot loader and external RAM is set up. The main boot loader loads the Linux kernel into RAM along with boot parameters. The Linux kernel initializes the system and launches the init process. The init process then launches the system services like the Zygote process and system server to finish booting up the device.
Linux Kernel Booting Process (1) - For NLKBshimosawa
Describes the bootstrapping part in Linux and some related technologies.
This is the part one of the slides, and the succeeding slides will contain the errata for this slide.
The Android booting process involves 5 stages:
1. The bootloader loads the kernel from flash memory into RAM.
2. The kernel initializes the system and loads drivers. It then launches the init process.
3. Init mounts filesystems and runs scripts to set up services. It also loads properties and launches the Zygote process.
4. Zygote preloads classes and resources. It forks to create new processes like the System Server using copy-on-write.
5. The System Server starts core system services. When complete, Android has finished booting and is ready for use.
This document provides an overview of porting Android to new platforms. It discusses the Android software stack, the Android Open Source Project structure, the AOSP code structure, common Android hardware abstraction layers, device configuration files, the AOSP build process, the Android boot process, and Android debugging tools.
This presentation covers the working model about Process, Thread, system call, Memory operations, Binder IPC, and interactions with Android frameworks.
Android booting sequece and setup and debuggingUtkarsh Mankad
The document summarizes key Android SDK components and concepts in 3 sentences or less:
Android SDK components are organized by functionality and include Activities, Services, BroadcastReceivers, Views, Intents, Adapters, AlertDialogs, Notifications, ContentProviders, and data storage methods. Common data storage options include SharedPreferences, internal storage, external storage, and SQLite databases. The Android booting process involves 6 stages: power on and ROM code execution, boot loader loading, starting the Linux kernel, initiating the init process, launching the Zygote and Dalvik virtual machine, and system server initiation.
In order to understand HAL layers of Android Framework, having Linux device driver knowledge is important. Hence Day-2 of the workshop focuses on the same.
Android boot time optimization involves measuring boot times, analyzing the results, and reducing times. Key areas of focus include the bootloader, kernel initialization, zygote class preloading, and system service startup. Hibernation technologies like QuickBoot and Fast-On can improve resume speeds by saving a system image to flash. The "R-Loader" concept aims to minimize hardware re-initialization on resume by directly loading a suspended kernel image.
This document outlines an introduction to the Android window system presented by Chia-I Wu. It covers the basic building blocks of SurfaceManager, WindowManager, and ActivityManager. It discusses concepts under the hood like process view, zygote, and binder. It also provides guidance on development tools and code areas relevant to understanding the window system.
This document summarizes the Grub2 booting process. It begins with the classical BIOS booting process where the BIOS finds and loads the MBR, which contains code to load the Grub core image. The core image loads modules to access disks and file systems to load the Linux kernel. For UEFI booting, the firmware loads the bootloader from an EFI System Partition, which contains Shim and Grub files. The document outlines the key files, modules, and steps in the Grub2 booting process for both BIOS and UEFI systems.
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
This document discusses booting Android devices. It covers Android boot images, bootloaders, fastboot protocol, and file systems used for different types of flash memory in Android devices. The key topics covered include bootloaders loading the boot and recovery images, the fastboot protocol for flashing and debugging, and file systems like ext4, f2fs, yaffs2 used on different flash chips like eMMC, SD cards, and raw NAND flash.
Have a quick overview of most of the embedded linux components and their details. How ti build Embedded Linux Hardware & Software, and developing Embedded Products
Linux Kernel and Driver Development TrainingStephan Cadene
This document provides information about a Linux Kernel and Driver Development training from Free Electrons. It begins with an overview of the course and hardware that will be used. It then discusses Free Electrons as a company and their online resources. The document also provides generic course information and guidelines for participation and the practical labs.
Présentation aux Geeks Anonymes Liège par Cyril Soldani, le 13 décembre 2017.
Page des Geeks Anonymes : https://www.recherche.uliege.be/cms/c_9463913/fr/geeks-anonymes
Learning AOSP - Android Linux Device DriverNanik Tolaram
This document discusses Android and Linux device drivers. It provides an overview of Android's core low-level software and hardware drivers, which perform minimum tasks and access the framework layer or libraries. It also describes the interaction between the kernel, framework, and virtual filesystem for key drivers like binder, logger, and USB. Configuration options for Android in the Linux kernel are listed, and resources for learning more about Android open source are provided.
The document provides an overview of the initialization process in the Linux kernel from start_kernel to rest_init. It lists the functions called during this process organized by category including functions for initialization of multiprocessor support (SMP), memory management (MM), scheduling, timers, interrupts, and architecture specific setup. The setup_arch section focuses on x86 architecture specific initialization functions such as reserving memory regions, parsing boot parameters, initializing memory mapping and MTRRs.
GDB can debug programs by running them under its control. It allows inspecting and modifying program state through breakpoints, watchpoints, and examining variables and memory. GDB supports debugging optimized code, multi-threaded programs, and performing tasks like stepping, continuing, and backtracing through the call stack. It can also automate debugging through commands, scripts, and breakpoint actions.
Unix was created in 1969 by Ken Thompson at Bell Labs to allow multiple users to access a computer simultaneously. It features a multi-user design, hierarchical file system, and shell interface. The kernel handles memory management, process scheduling, and device interactions to enable these features. Common Unix commands like cat, ls, cp and rm allow users to work with files and directories from the shell. File permissions and ownership are managed through inodes to control access across users.
The document discusses three sanitizers - AddressSanitizer, ThreadSanitizer, and MemorySanitizer - that detect bugs in C/C++ programs. AddressSanitizer detects memory errors like buffer overflows and use-after-frees. ThreadSanitizer finds data races between threads. MemorySanitizer identifies uses of uninitialized memory. The sanitizers work by instrumenting code at compile-time and providing a run-time library for error detection and reporting. They have found thousands of bugs in major software projects with reasonable overhead. Future work includes supporting more platforms and detecting additional classes of bugs.
A tutorial for beginners who are curious to learn about the Linux boot process. If you have any more doubts, you can contact me through my email given in the slide, or through my blog: mastro77.blogspot.in
Slides from Android Builder's Summit 2014 in San Jose, CA
In this talk I describe the internal workings of the Android graphics stack from the Application layer down through the stack to pixels on the screen. It is a fairly complex journey, taking in two different 2D rendering engines, applications calling OpenGL ES directory, passing buffers on to the system compositor, SurfaceFlinger, and then down to the display controller or frame buffer.
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs Sam Bowne
The document discusses various application programming interfaces (APIs) and techniques used by malicious programs on Windows systems. It describes the Windows API and common data types. It also covers lower-level APIs like the Native API, and how malware authors leverage APIs, dynamic link libraries (DLLs), processes, threads, mutexes, services, and other techniques to interact with the operating system and maintain persistence. The document provides technical details to help analysts understand how malware functions on Windows.
An Introduction to Makefile.
about 23 slides to present you a quick start to the make utility, its usage and working principles. Some tips/examples in order to understand and write your own
Makefiles.
In this presentation you will learn why this utility continues to hold its top position in project build software, despite many younger competitors.
Visit Do you know Magazine : https://www.facebook.com/douknowmagazine
The document discusses the architecture of the Linux operating system. It contains five main components: the kernel, system libraries, hardware layer, system utilities, and shell. The kernel is the core of the operating system that facilitates interactions between hardware and software. It connects applications to system hardware. The system libraries help applications access the kernel's features through system calls. System utilities provide specialized functions to users. The hardware layer refers to physical machine components like RAM and CPU. The shell acts as an interface between the kernel and user, running kernel functions and taking user commands.
The document discusses the activity lifecycle in Android, describing the different states an activity can be in (starting, running, paused, stopped, destroyed) and the methods called during transitions between these states (onCreate, onPause, onResume, onStop, onDestroy). It provides details on the role and proper use of each method, such as initializing resources in onCreate, stopping animations in onPause, and releasing resources in onDestroy. Logging with LogCat is also described as a way to test activity state changes.
This document discusses the Android multimedia framework on Jelly Bean. It provides an introduction to OpenMAX and describes the simple stack architecture including the developer API, event handler, surface holder, StageFright, OpenMAX interface, and software/hardware codecs. It explains the workflows and sequence flows for playing a media file, including setting the data source, preparing to play, and starting playback. Finally, it covers the synchronization architecture and flow of StageFright.
How to implement a simple dalvik virtual machineChun-Yu Wang
This slide is an introduction to Android Dalvik Virtual Machine on a short course.
We use two hand-made JVM and DVM which called Simple JVM and Simple DVM respectively, to tell student how they work. A Foo Class was provided as a target for verifying the execution results of those VM. We hope it will help student to understand JVM and DVM quickly.
Inside Android's Dalvik VM - NEJUG Nov 2011Doug Hawkins
In this presentation, Doug Hawkins will discuss how the Dalvik VM is different from traditional Java VMs and the motivations behind those differences. Along the way, you'll learn about Android's service architecture, Dalvik's byte code format, and the surprising details of how Android installs, launches, and executes applications.
Android boot time optimization involves measuring boot times, analyzing the results, and reducing times. Key areas of focus include the bootloader, kernel initialization, zygote class preloading, and system service startup. Hibernation technologies like QuickBoot and Fast-On can improve resume speeds by saving a system image to flash. The "R-Loader" concept aims to minimize hardware re-initialization on resume by directly loading a suspended kernel image.
This document outlines an introduction to the Android window system presented by Chia-I Wu. It covers the basic building blocks of SurfaceManager, WindowManager, and ActivityManager. It discusses concepts under the hood like process view, zygote, and binder. It also provides guidance on development tools and code areas relevant to understanding the window system.
This document summarizes the Grub2 booting process. It begins with the classical BIOS booting process where the BIOS finds and loads the MBR, which contains code to load the Grub core image. The core image loads modules to access disks and file systems to load the Linux kernel. For UEFI booting, the firmware loads the bootloader from an EFI System Partition, which contains Shim and Grub files. The document outlines the key files, modules, and steps in the Grub2 booting process for both BIOS and UEFI systems.
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
This document discusses booting Android devices. It covers Android boot images, bootloaders, fastboot protocol, and file systems used for different types of flash memory in Android devices. The key topics covered include bootloaders loading the boot and recovery images, the fastboot protocol for flashing and debugging, and file systems like ext4, f2fs, yaffs2 used on different flash chips like eMMC, SD cards, and raw NAND flash.
Have a quick overview of most of the embedded linux components and their details. How ti build Embedded Linux Hardware & Software, and developing Embedded Products
Linux Kernel and Driver Development TrainingStephan Cadene
This document provides information about a Linux Kernel and Driver Development training from Free Electrons. It begins with an overview of the course and hardware that will be used. It then discusses Free Electrons as a company and their online resources. The document also provides generic course information and guidelines for participation and the practical labs.
Présentation aux Geeks Anonymes Liège par Cyril Soldani, le 13 décembre 2017.
Page des Geeks Anonymes : https://www.recherche.uliege.be/cms/c_9463913/fr/geeks-anonymes
Learning AOSP - Android Linux Device DriverNanik Tolaram
This document discusses Android and Linux device drivers. It provides an overview of Android's core low-level software and hardware drivers, which perform minimum tasks and access the framework layer or libraries. It also describes the interaction between the kernel, framework, and virtual filesystem for key drivers like binder, logger, and USB. Configuration options for Android in the Linux kernel are listed, and resources for learning more about Android open source are provided.
The document provides an overview of the initialization process in the Linux kernel from start_kernel to rest_init. It lists the functions called during this process organized by category including functions for initialization of multiprocessor support (SMP), memory management (MM), scheduling, timers, interrupts, and architecture specific setup. The setup_arch section focuses on x86 architecture specific initialization functions such as reserving memory regions, parsing boot parameters, initializing memory mapping and MTRRs.
GDB can debug programs by running them under its control. It allows inspecting and modifying program state through breakpoints, watchpoints, and examining variables and memory. GDB supports debugging optimized code, multi-threaded programs, and performing tasks like stepping, continuing, and backtracing through the call stack. It can also automate debugging through commands, scripts, and breakpoint actions.
Unix was created in 1969 by Ken Thompson at Bell Labs to allow multiple users to access a computer simultaneously. It features a multi-user design, hierarchical file system, and shell interface. The kernel handles memory management, process scheduling, and device interactions to enable these features. Common Unix commands like cat, ls, cp and rm allow users to work with files and directories from the shell. File permissions and ownership are managed through inodes to control access across users.
The document discusses three sanitizers - AddressSanitizer, ThreadSanitizer, and MemorySanitizer - that detect bugs in C/C++ programs. AddressSanitizer detects memory errors like buffer overflows and use-after-frees. ThreadSanitizer finds data races between threads. MemorySanitizer identifies uses of uninitialized memory. The sanitizers work by instrumenting code at compile-time and providing a run-time library for error detection and reporting. They have found thousands of bugs in major software projects with reasonable overhead. Future work includes supporting more platforms and detecting additional classes of bugs.
A tutorial for beginners who are curious to learn about the Linux boot process. If you have any more doubts, you can contact me through my email given in the slide, or through my blog: mastro77.blogspot.in
Slides from Android Builder's Summit 2014 in San Jose, CA
In this talk I describe the internal workings of the Android graphics stack from the Application layer down through the stack to pixels on the screen. It is a fairly complex journey, taking in two different 2D rendering engines, applications calling OpenGL ES directory, passing buffers on to the system compositor, SurfaceFlinger, and then down to the display controller or frame buffer.
Practical Malware Analysis: Ch 7: Analyzing Malicious Windows Programs Sam Bowne
The document discusses various application programming interfaces (APIs) and techniques used by malicious programs on Windows systems. It describes the Windows API and common data types. It also covers lower-level APIs like the Native API, and how malware authors leverage APIs, dynamic link libraries (DLLs), processes, threads, mutexes, services, and other techniques to interact with the operating system and maintain persistence. The document provides technical details to help analysts understand how malware functions on Windows.
An Introduction to Makefile.
about 23 slides to present you a quick start to the make utility, its usage and working principles. Some tips/examples in order to understand and write your own
Makefiles.
In this presentation you will learn why this utility continues to hold its top position in project build software, despite many younger competitors.
Visit Do you know Magazine : https://www.facebook.com/douknowmagazine
The document discusses the architecture of the Linux operating system. It contains five main components: the kernel, system libraries, hardware layer, system utilities, and shell. The kernel is the core of the operating system that facilitates interactions between hardware and software. It connects applications to system hardware. The system libraries help applications access the kernel's features through system calls. System utilities provide specialized functions to users. The hardware layer refers to physical machine components like RAM and CPU. The shell acts as an interface between the kernel and user, running kernel functions and taking user commands.
The document discusses the activity lifecycle in Android, describing the different states an activity can be in (starting, running, paused, stopped, destroyed) and the methods called during transitions between these states (onCreate, onPause, onResume, onStop, onDestroy). It provides details on the role and proper use of each method, such as initializing resources in onCreate, stopping animations in onPause, and releasing resources in onDestroy. Logging with LogCat is also described as a way to test activity state changes.
This document discusses the Android multimedia framework on Jelly Bean. It provides an introduction to OpenMAX and describes the simple stack architecture including the developer API, event handler, surface holder, StageFright, OpenMAX interface, and software/hardware codecs. It explains the workflows and sequence flows for playing a media file, including setting the data source, preparing to play, and starting playback. Finally, it covers the synchronization architecture and flow of StageFright.
How to implement a simple dalvik virtual machineChun-Yu Wang
This slide is an introduction to Android Dalvik Virtual Machine on a short course.
We use two hand-made JVM and DVM which called Simple JVM and Simple DVM respectively, to tell student how they work. A Foo Class was provided as a target for verifying the execution results of those VM. We hope it will help student to understand JVM and DVM quickly.
Inside Android's Dalvik VM - NEJUG Nov 2011Doug Hawkins
In this presentation, Doug Hawkins will discuss how the Dalvik VM is different from traditional Java VMs and the motivations behind those differences. Along the way, you'll learn about Android's service architecture, Dalvik's byte code format, and the surprising details of how Android installs, launches, and executes applications.
Understanding the Dalvik bytecode with the Dedexer toolGabor Paller
This document discusses the Dalvik virtual machine used in Android and how to decompile Dalvik bytecode using the Dedexer tool. It provides background on Android's use of Java and the Dalvik VM. Key points include: Dalvik uses its own bytecode format rather than Java bytecode and executes applications; the Dedexer tool can be used to disassemble DEX files back into Dalvik bytecode; and differences in Dalvik like its register-based rather than stack-based design are explained. Examples of Dalvik bytecode instructions and register usage are also provided.
With growth in app market it is essential to guard our android apps against possible threats, in this presentation we will walk through various tools and techniques which some one can use to reverse engineer an android app, we will see how some one can get access to APP DB, CODE, API, PREFERENCES.
We will also see different tools and techniques to guard our app against possible threats from code obfuscation with tools like dexgaurd to newer methods like verification of api calls using google play services.
This session was taken in Barcamp 13 bangalore http://barcampbangalore.org/bcb/bcb13/reverse-engineering-an-android-app-securing-your-android-apps-against-attacks
and bangalore android user group meetup Jan meetup http://www.meetup.com/blrdroid/events/100360682/
(Presentation at HITcon 2011) This talk introduces how to do Android application reverse engineering by real example. And, it covers the advanced topics like optimized DEX and JNI.
Android internals 05 - Dalvik VM (rev_1.1)Egor Elizarov
This document discusses the Dalvik virtual machine (VM) used in Android. It begins with an overview of VMs and describes Dalvik as a register-based VM that relies on the operating system for memory management, threading, and process isolation. It then covers Dalvik bytecode, the interpreter core, just-in-time compilation, application launching via the Zygote process, and porting Dalvik to new platforms.
So you've reversed you're first Android APK; now what? Java pseduocode is nice, but how do we modify the app? This is a crash course in reading and understanding Davlik opcodes. It will go through some basics then we will jump into a couple case studies to demonstrate some of the concepts. This talk should help testers who are interested in or do Android application assessments to better understand how to mess with the underlying code.
This document discusses the Java Native Interface (JNI) which allows Java code running in the Java Virtual Machine (JVM) to call and be called by native code such as C and C++. It provides an overview of JNI and walks through a sample implementation in 5 steps. It also discusses more details of JNI including JNI types, the JNIEnv interface, accessing fields and methods, and managing native memory.
LinkedIn - Disassembling Dalvik BytecodeAlain Leon
The document discusses disassembling Dalvik bytecode on Android. It begins by providing background on Android, Dalvik VM, APK files, DEX files, and JIT compilation. It then discusses ways to hack at different levels: using macros to automate games, intercepting REST traffic, analyzing APK/DEX files by decompiling them and modifying bytecode, analyzing and modifying shared object libraries, and disassembling machine code. The key steps outlined are decompiling DEX to Smali bytecode, applying changes, recompiling to an APK, installing on a device, and analyzing shared object libraries by disassembling to machine code.
This document summarizes a presentation on reverse engineering obfuscated Android applications. It discusses reverse engineering techniques like static and dynamic analysis. It covers analyzing the Android application package (APK) file format and tools like apktool, smali, baksmali, and dex2jar. Common obfuscation techniques like string encryption, call hiding using reflection, and native code are also summarized. The document concludes by recommending further reading on tools and the arms race between attackers and defenders applying obfuscation.
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
HotSpot promises to do the "right" thing for us by identifying our hot code and compiling "just-in-time", but how does HotSpot make those decisions?
This presentation aims to detail how HotSpot makes those decisions and how it corrects its mistakes through a series of demos that you run yourself.
The new runtime which Google is started implementing as developers view to implement or not which has advantages over the previous Dalvik runtime and more...
Presentation on Android operating systemSalma Begum
The document summarizes information about the Android operating system. It discusses the origin of Android, its features, architecture, versions, application development process, limitations and future. Android was developed by Android Inc which was later acquired by Google. It has an open source model and uses Linux kernel. The architecture includes libraries, Dalvik VM, application framework and core applications. There are many versions of Android with incremental updates and improvements.
[1D6]RE-view of Android L developer PRE-viewNAVER D2
The document discusses key architectural changes and performance improvements in Android L, including:
1. The introduction of a separate UI and render thread to improve responsiveness.
2. A move from just-in-time (JIT) compilation to ahead-of-time (AOT) compilation with the new Android Runtime (ART) to boost performance.
3. Enhancements to the garbage collection model to reduce pause times and fragmentation.
The document discusses Just-In-Time (JIT) compilation in Android. It begins by explaining the problem with interpreting bytecode, which is slower than native compilation. JIT compilation improves performance by compiling bytecode to native machine code at runtime. The Android Dalvik VM uses a trace-based JIT compiler that identifies and compiles hot regions of code. It generates an intermediate representation (IR) of the code and performs optimizations before code generation. The IR allows machine-specific optimizations to be performed.
JNode is a Java-based operating system that is actively developed and open source. It uses a plugin framework so that everything, including the JVM and framework, can be loaded as plugins. The driver framework finds and maps hardware devices to Java drivers through extension points. Future goals include improved performance, a deployment framework, and a document-oriented desktop environment. Java benefits the OS through dynamic linking, type safety, security features, and development tools.
Life after Java - Reusing Code and Skills in a .NET world / presentation at ITProDevConnections 2010 - http://www.itprodevconnections.gr
The document provides an introduction to the Java programming language. It discusses that Java was created by Sun Microsystems to allow web pages to include interactive Java code. It is a simple, object-oriented, portable language that uses bytecode and a virtual machine to achieve platform independence. The document outlines Java's core features such as being distributed, multithreaded, robust, secure, and high performance. It also summarizes Java's basic data types, classes, objects, and how to write both applications and applets.
In dieser Session werfen wir einen Blick auf die Android Platform jenseits der Dalvik VM. Wir entdecken den Android Source Code und erklären wo sich interessante Beispiele und Referenzen für App-Entwickler sowie nützliche Tools verbergen. Ein High-Level Überblick über die Platform-Architektur und das Platform-Build-System runden die Session ab.
The document provides an introduction to Java servlets and JavaServer Pages (JSP). It discusses servlet lifecycles and interfaces like ServletRequest and RequestDispatcher. It covers session tracking techniques including cookies, hidden form fields, and URL rewriting. It also mentions servlet events and listeners.
The document discusses the Java Virtual Machine (JVM) architecture and memory. It covers the following key points:
1. The JVM is the foundation of the Java platform and provides hardware- and operating system-independence for Java programs.
2. The JVM memory is divided into heap spaces like Eden space and survivor space, as well as non-heap spaces like the permanent generation and code cache.
3. Benefits of the JVM include security, cross-platform capability, while drawbacks include slower speed compared to native compilation and lack of platform-specific features.
- The document provides an introduction to Java programming including an overview of Java, its history, platforms, architecture, components, applications, features, and setting up Java.
- It describes Java as a simple, general-purpose, object-oriented language that is architecture neutral, portable, robust and secure.
- The document outlines the key components of Java including the Java Virtual Machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK).
Amazon Web Services (AWS) is an online cloud computing platform that allows users to store data and run applications on their own servers. It offers services such as web hosting, database management, email, storage, analytics, mobile apps, and more. This course will teach you how to use AWS for various purposes.
Amazon Web Services (AWS) is an online cloud computing platform that allows users to store data and run applications on their own servers. It offers services such as web hosting, database management, email, storage, analytics, mobile apps, and more. This course will teach you how to use AWS for various purposes.
Java : Components
Java : Features
Java : Security
Java better than C++
Basic Data Types
Applications : Types
Life Cycle of Java Code
Java Development Kit
Java Example
Mechanism of Applets
Significance of downloading Applets
Used Java Main Packages
Java is a widely used programming language that is mainly used for application programming. It is platform-independent and supports features like multi-threading and documentation comments. The key aspects of a simple Java program are that it must contain a class with a main method that can be the starting point of execution. The main method has a specific signature of public static void main(String[] args). When a Java program is run, the JVM (Java Virtual Machine) loads and executes the program by performing operations like loading code, verifying code, and providing a runtime environment.
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)JiandSon
This document provides debugging tips for Xcode including using breakpoint actions, exception breakpoints, symbolic breakpoints, and static analysis. It compares ARC and non-ARC debugging and discusses diagnostic tools like memory management and logging. Finally, it introduces DTrace as a dynamic tracing facility for macOS and iOS.
The document discusses Java bytecode and the Java Virtual Machine (JVM). It provides details on:
- Bytecode is machine language for the JVM and is stored in class files. Each method has its own bytecode stream.
- Bytecode instructions consist of opcodes and operands that are executed by the JVM. Common opcodes include iconst_0, istore_0, iinc, iload_0, etc.
- The JVM has various components like the class loader, runtime data areas (method area, heap, stacks), and execution engine that interprets or compiles bytecode to machine code.
This document discusses multithreading in Android. It describes how the AsyncTask class can be used to perform background operations and publish results on the UI thread without manipulating threads directly. It also explains how the Handler class allows sending and processing Message and Runnable objects on a specific thread's message queue, allowing actions to be performed on a different thread than the current one using post() and sendMessage(). Multithreading improves performance on systems with multiple CPUs by allowing tasks to be separated into independent threads that can execute in parallel.
The document provides an overview of key Java concepts:
1. Java is an object-oriented, platform-independent language that is compiled to bytecode and interpreted by the Java Virtual Machine (JVM).
2. The JVM handles security, memory management through garbage collection, and allows multithreaded programming.
3. Developers use the Java Development Kit (JDK) for coding Java applications, which includes the compiler, JVM, and other tools. The Java Runtime Environment (JRE) provides minimum requirements to run Java applications.
Presented by: N.V.Rajasekhar Reddy
www.technolamp.co.in
Want more interesting...
Watch and Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
Java is an object-oriented programming language originally developed by Sun Microsystems. There are four main types of Java applications: standalone, web, enterprise, and mobile. The key features of Java include being platform independent, secure, robust, and distributed. Java code is compiled into bytecode that runs on a Java Virtual Machine (JVM) on any device. The JVM performs tasks like loading code, memory management, and execution. There are various data types in Java including primitives like int and double, and reference types like classes. Variables are used to store and reference values in memory and can be local, instance, or class variables. Arrays provide a way to store multiple values of the same type.
PyPy takes a tracing just-in-time (JIT) compilation approach to optimize Python programs. It works by first interpreting the program, then tracing hot loops and optimizing their performance by compiling them to machine code. This JIT compilation generates and runs optimized trace trees representing the control flow and operations within loops. If guards placed in the compiled code fail, indicating the optimization may no longer apply, execution falls back to the interpreter or recompiles the trace with additional information. PyPy's approach aims to optimize the most common execution paths of Python programs for high performance while still supporting Python's dynamic nature.
This document discusses making Linux capable of hard real-time performance. It begins by defining hard and soft real-time systems and explaining that real-time does not necessarily mean fast but rather determinism. It then covers general concepts around real-time performance in Linux like preemption, interrupts, context switching, and scheduling. Specific features in Linux like RT-Preempt, priority inheritance, and threaded interrupts that improve real-time capabilities are also summarized.
Introduce Brainf*ck, another Turing complete programming language. Then, try to implement the following from scratch: Interpreter, Compiler [x86_64 and ARM], and JIT Compiler.
The promise of the IoT won’t be fulfilled until integrated
software platforms are available that allow software
developers to develop these devices efficiently and in
the most cost-effective manner possible.
This presentation introduces F9 microkernel, new open source
implementation built from scratch, which deploys
modern kernel techniques dedicated to deeply
embedded devices.
The document discusses how a "Hello World" program works behind the scenes. It covers topics like compilation, linking, executable file formats, loading programs into memory, and process creation. The key points are:
1) A C program is compiled into an object file, then linked with library files to create an executable. The linker resolves symbols and relocates addresses.
2) Executable files use formats like ELF that contain machine code, data, symbol tables, and sections. Object files have a similar format.
3) When a program runs, the OS loads pages of the executable into memory as needed and sets up the process with its own virtual address space.
4) System calls
Build a full-functioned virtual machine from scratch, when Brainfuck is used. Basic concepts about interpreter, optimizations techniques, language specialization, and platform specific tweaks.
Xvisor is an open source lightweight hypervisor for ARM architectures. It uses a technique called cpatch to modify guest operating system binaries, replacing privileged instructions with hypercalls. This allows the guest OS to run without privileges in user mode under the hypervisor. Xvisor also implements virtual CPU and memory management to isolate guest instances and virtualize physical resources for multiple operating systems.
This presentation covers the general concepts about real-time systems, how Linux kernel works for preemption, the latency in Linux, rt-preempt, and Xenomai, the real-time extension as the dual kernel approach.
The Mars Pathfinder mission successfully demonstrated new landing techniques and returned valuable data from the Martian surface. However, it experienced issues with priority inversion in its VxWorks real-time operating system. The lower priority weather data collection task would occasionally prevent the higher priority communication task from completing before the next cycle began, resetting the system. Engineers traced the problem to the use of VxWorks' select() call to wait for I/O from multiple devices, allowing long-running lower priority tasks to block critical higher priority tasks.
* Know the reasons why various operating systems exist and how they are functioned for dedicated purposes
* Understand the basic concepts while building system software from scratch
• How can we benefit from cheap ARM boards and the related open source tools?
- Raspberry Pi & STM32F4-Discovery
F9 is a new open source microkernel designed for deeply embedded systems like IoT devices. It aims to provide efficiency, security, and a flexible development environment. F9 follows microkernel principles with minimal kernel functionality and isolates components as user-level processes. It uses capabilities for access control and focuses on performance through techniques like tickless scheduling and adaptive power management.
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...Alan Dix
Talk at the final event of Data Fusion Dynamics: A Collaborative UK-Saudi Initiative in Cybersecurity and Artificial Intelligence funded by the British Council UK-Saudi Challenge Fund 2024, Cardiff Metropolitan University, 29th April 2025
https://alandix.com/academic/talks/CMet2025-AI-Changes-Everything/
Is AI just another technology, or does it fundamentally change the way we live and think?
Every technology has a direct impact with micro-ethical consequences, some good, some bad. However more profound are the ways in which some technologies reshape the very fabric of society with macro-ethical impacts. The invention of the stirrup revolutionised mounted combat, but as a side effect gave rise to the feudal system, which still shapes politics today. The internal combustion engine offers personal freedom and creates pollution, but has also transformed the nature of urban planning and international trade. When we look at AI the micro-ethical issues, such as bias, are most obvious, but the macro-ethical challenges may be greater.
At a micro-ethical level AI has the potential to deepen social, ethnic and gender bias, issues I have warned about since the early 1990s! It is also being used increasingly on the battlefield. However, it also offers amazing opportunities in health and educations, as the recent Nobel prizes for the developers of AlphaFold illustrate. More radically, the need to encode ethics acts as a mirror to surface essential ethical problems and conflicts.
At the macro-ethical level, by the early 2000s digital technology had already begun to undermine sovereignty (e.g. gambling), market economics (through network effects and emergent monopolies), and the very meaning of money. Modern AI is the child of big data, big computation and ultimately big business, intensifying the inherent tendency of digital technology to concentrate power. AI is already unravelling the fundamentals of the social, political and economic world around us, but this is a world that needs radical reimagining to overcome the global environmental and human challenges that confront us. Our challenge is whether to let the threads fall as they may, or to use them to weave a better future.
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfAbi john
Analyze the growth of meme coins from mere online jokes to potential assets in the digital economy. Explore the community, culture, and utility as they elevate themselves to a new era in cryptocurrency.
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfSoftware Company
Explore the benefits and features of advanced logistics management software for businesses in Riyadh. This guide delves into the latest technologies, from real-time tracking and route optimization to warehouse management and inventory control, helping businesses streamline their logistics operations and reduce costs. Learn how implementing the right software solution can enhance efficiency, improve customer satisfaction, and provide a competitive edge in the growing logistics sector of Riyadh.
This is the keynote of the Into the Box conference, highlighting the release of the BoxLang JVM language, its key enhancements, and its vision for the future.
Generative Artificial Intelligence (GenAI) in BusinessDr. Tathagat Varma
My talk for the Indian School of Business (ISB) Emerging Leaders Program Cohort 9. In this talk, I discussed key issues around adoption of GenAI in business - benefits, opportunities and limitations. I also discussed how my research on Theory of Cognitive Chasms helps address some of these issues
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell
With expertise in data architecture, performance tracking, and revenue forecasting, Andrew Marnell plays a vital role in aligning business strategies with data insights. Andrew Marnell’s ability to lead cross-functional teams ensures businesses achieve sustainable growth and operational excellence.
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungenpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-nomad-web-best-practices-und-verwaltung-von-multiuser-umgebungen/
HCL Nomad Web wird als die nächste Generation des HCL Notes-Clients gefeiert und bietet zahlreiche Vorteile, wie die Beseitigung des Bedarfs an Paketierung, Verteilung und Installation. Nomad Web-Client-Updates werden “automatisch” im Hintergrund installiert, was den administrativen Aufwand im Vergleich zu traditionellen HCL Notes-Clients erheblich reduziert. Allerdings stellt die Fehlerbehebung in Nomad Web im Vergleich zum Notes-Client einzigartige Herausforderungen dar.
Begleiten Sie Christoph und Marc, während sie demonstrieren, wie der Fehlerbehebungsprozess in HCL Nomad Web vereinfacht werden kann, um eine reibungslose und effiziente Benutzererfahrung zu gewährleisten.
In diesem Webinar werden wir effektive Strategien zur Diagnose und Lösung häufiger Probleme in HCL Nomad Web untersuchen, einschließlich
- Zugriff auf die Konsole
- Auffinden und Interpretieren von Protokolldateien
- Zugriff auf den Datenordner im Cache des Browsers (unter Verwendung von OPFS)
- Verständnis der Unterschiede zwischen Einzel- und Mehrbenutzerszenarien
- Nutzung der Client Clocking-Funktion
Spark is a powerhouse for large datasets, but when it comes to smaller data workloads, its overhead can sometimes slow things down. What if you could achieve high performance and efficiency without the need for Spark?
At S&P Global Commodity Insights, having a complete view of global energy and commodities markets enables customers to make data-driven decisions with confidence and create long-term, sustainable value. 🌍
Explore delta-rs + CDC and how these open-source innovations power lightweight, high-performance data applications beyond Spark! 🚀
Quantum Computing Quick Research Guide by Arthur MorganArthur Morgan
This is a Quick Research Guide (QRG).
QRGs include the following:
- A brief, high-level overview of the QRG topic.
- A milestone timeline for the QRG topic.
- Links to various free online resource materials to provide a deeper dive into the QRG topic.
- Conclusion and a recommendation for at least two books available in the SJPL system on the QRG topic.
QRGs planned for the series:
- Artificial Intelligence QRG
- Quantum Computing QRG
- Big Data Analytics QRG
- Spacecraft Guidance, Navigation & Control QRG (coming 2026)
- UK Home Computing & The Birth of ARM QRG (coming 2027)
Any questions or comments?
- Please contact Arthur Morgan at [email protected].
100% human made.
Dev Dives: Automate and orchestrate your processes with UiPath MaestroUiPathCommunity
This session is designed to equip developers with the skills needed to build mission-critical, end-to-end processes that seamlessly orchestrate agents, people, and robots.
📕 Here's what you can expect:
- Modeling: Build end-to-end processes using BPMN.
- Implementing: Integrate agentic tasks, RPA, APIs, and advanced decisioning into processes.
- Operating: Control process instances with rewind, replay, pause, and stop functions.
- Monitoring: Use dashboards and embedded analytics for real-time insights into process instances.
This webinar is a must-attend for developers looking to enhance their agentic automation skills and orchestrate robust, mission-critical processes.
👨🏫 Speaker:
Andrei Vintila, Principal Product Manager @UiPath
This session streamed live on April 29, 2025, 16:00 CET.
Check out all our upcoming Dev Dives sessions at https://community.uipath.com/dev-dives-automation-developer-2025/.
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Impelsys Inc.
Impelsys provided a robust testing solution, leveraging a risk-based and requirement-mapped approach to validate ICU Connect and CritiXpert. A well-defined test suite was developed to assess data communication, clinical data collection, transformation, and visualization across integrated devices.
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPathCommunity
Join this UiPath Community Berlin meetup to explore the Orchestrator API, Swagger interface, and the Test Manager API. Learn how to leverage these tools to streamline automation, enhance testing, and integrate more efficiently with UiPath. Perfect for developers, testers, and automation enthusiasts!
📕 Agenda
Welcome & Introductions
Orchestrator API Overview
Exploring the Swagger Interface
Test Manager API Highlights
Streamlining Automation & Testing with APIs (Demo)
Q&A and Open Discussion
Perfect for developers, testers, and automation enthusiasts!
👉 Join our UiPath Community Berlin chapter: https://community.uipath.com/berlin/
This session streamed live on April 29, 2025, 18:00 CET.
Check out all our upcoming UiPath Community sessions at https://community.uipath.com/events/.
HCL Nomad Web – Best Practices and Managing Multiuser Environmentspanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-nomad-web-best-practices-and-managing-multiuser-environments/
HCL Nomad Web is heralded as the next generation of the HCL Notes client, offering numerous advantages such as eliminating the need for packaging, distribution, and installation. Nomad Web client upgrades will be installed “automatically” in the background. This significantly reduces the administrative footprint compared to traditional HCL Notes clients. However, troubleshooting issues in Nomad Web present unique challenges compared to the Notes client.
Join Christoph and Marc as they demonstrate how to simplify the troubleshooting process in HCL Nomad Web, ensuring a smoother and more efficient user experience.
In this webinar, we will explore effective strategies for diagnosing and resolving common problems in HCL Nomad Web, including
- Accessing the console
- Locating and interpreting log files
- Accessing the data folder within the browser’s cache (using OPFS)
- Understand the difference between single- and multi-user scenarios
- Utilizing Client Clocking
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxJustin Reock
Building 10x Organizations with Modern Productivity Metrics
10x developers may be a myth, but 10x organizations are very real, as proven by the influential study performed in the 1980s, ‘The Coding War Games.’
Right now, here in early 2025, we seem to be experiencing YAPP (Yet Another Productivity Philosophy), and that philosophy is converging on developer experience. It seems that with every new method we invent for the delivery of products, whether physical or virtual, we reinvent productivity philosophies to go alongside them.
But which of these approaches actually work? DORA? SPACE? DevEx? What should we invest in and create urgency behind today, so that we don’t find ourselves having the same discussion again in a decade?
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025BookNet Canada
Book industry standards are evolving rapidly. In the first part of this session, we’ll share an overview of key developments from 2024 and the early months of 2025. Then, BookNet’s resident standards expert, Tom Richardson, and CEO, Lauren Stewart, have a forward-looking conversation about what’s next.
Link to recording, transcript, and accompanying resource: https://bnctechforum.ca/sessions/standardsgoals-for-2025-standards-certification-roundup/
Presented by BookNet Canada on May 6, 2025 with support from the Department of Canadian Heritage.
3. Myself was a Kaffe (world-frist open source JVM)
Developer
● Threaded Interpreter, JIT, AWT for
embedded system, robustness
was a GCJ (Java Frontend for GCC)
and GNU Classpath Developer
is an AOSP (Android Open Source
Project) contributror
● 45+ patches are merged officially
● bionic libc, ARM optimizations
4. Goals of This Presentation
• Understand how a virtual machine works
• Analyze the Dalvik VM using existing tools
• VM hacking is really interesting!
6. Reference Hardware and Host
Configurations
• Android Phone: Nexus S
– http://www.google.com/phone/detail/nexus-s
– Install CyanogenMod (CM9)
http://www.cyanogenmod.com/
• Host: Lenovo x200
– Ubuntu Linux 11.10+ (32-bit)
• AOSP/CM9 source code: 4.0.3
• Follow the instructions in Wiki
http://wiki.cyanogenmod.com/wiki/Building_from_source
7. Build CyanogenMod from Source
• cyanogen-ics$ source build/envsetup.sh
including device/moto/stingray/vendorsetup.sh
including device/moto/wingray/vendorsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/samsung/toro/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including vendor/cm/vendorsetup.sh
including sdk/bash_completion/adb.bash
• cyanogen-ics$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. full-eng Target: cm_crespo
… Configuration: userdebug
8. full_panda-eng
9. cm_crespo-userdebug
8. Nexus S Device Configurations
• Which would you like? [full-eng] 9
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.3
TARGET_PRODUCT=cm_crespo
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=MR1
============================================
9. Build Dalvik VM
(ARM Target + x86 Host)
• cyanogen-ics$ make dalvikvm dalvik
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.3
TARGET_PRODUCT=cm_crespo
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
… libdvm.so is the VM engine
Install: out/host/linux-x86/lib/libdvm.so
Install: out/target/product/crespo/system/bin/dalvikvm
host C++: dalvikvm <= dalvik/dalvikvm/Main.cpp
host Executable: dalvikvm Install: out/host/linux-
x86/bin/dalvikvm
Copy: dalvik (out/host/linux-
x86/obj/EXECUTABLES/dalvik_intermediates/dalvik)
Install: out/host/linux-x86/bin/dalvik
“dalvik” is a shell script to launch dvm
10. Dalvik VM requires core APIs for runtime
cyanogen-ics$ out/host/linux-x86/bin/dalvik
E( 6983) No valid entries found in bootclasspath
'/tmp/cyanogen-ics/out/host/linux-x86/framework/core-
hostdex.jar:/tmp/cyanogen-ics/out/host/linux-
x86/framework/bouncycastle-hostdex.jar:/tmp/cyanogen-
ics/out/host/linux-x86/framework/apache-xml-
hostdex.jar' (dalvikvm)
E( 6983) VM aborting (dalvikvm)
...
out/host/linux-x86/bin/dalvik: line 28: 6983
Segmentation fault (core dumped)
ANDROID_PRINTF_LOG=tag ANDROID_LOG_TAGS=""
ANDROID_DATA=/tmp/android-data
ANDROID_ROOT=$ANDROID_BUILD_TOP/out/host/linux-x86
LD_LIBRARY_PATH=$ANDROID_BUILD_TOP/out/host/linux-x86/lib
$ANDROID_BUILD_TOP/out/host/linux-x86/bin/dalvikvm -Xbootclasspath:
$ANDROID_BUILD_TOP/out/host/linux-x86/framework/core-hostdex.jar:
$ANDROID_BUILD_TOP/out/host/linux-x86/framework/bouncycastle-
hostdex.jar:
$ANDROID_BUILD_TOP/out/host/linux-x86/framework/apache-xml-
hostdex.jar $*
11. Satisfy Dalvik Runtime Dependency
cyanogen-ics$ make bouncycastle bouncycastle-hostdex
cyanogen-ics$ make sqlite-jdbc mockwebserver
cyanogen-ics$ make sqlite-jdbc-host
cyanogen-ics$ make mockwebserver-hostdex
cyanogen-ics$ make apache-xml-hostdex
cyanogen-ics$ (cd libcore && make)
cyanogen-ics$ out/host/linux-x86/bin/dalvik
...
I(19820) Unable to open or create cache for
/tmp/cyanogen-ics/out/host/linux-x86/framework/core-
hostdex.jar (/data/dalvik-cache/tmp@cyanogen-
ics@out@host@linux-x86@framework@core-
[email protected]) (dalvikvm)
E(19820) Could not stat dex cache directory
'/data/dalvik-cache': No such file or directory
(dalvikvm)
Extra space for "dalvik-cache" is required.
12. Host-side Dalvik VM
cyanogen-ics$ make dexopt
cyanogen-ics$ sudo mkdir -p /data/dalvik-cache
cyanogen-ics$ sudo chmod 777 /data/dalvik-cache
cyanogen-ics$ out/host/linux-x86/bin/dalvik
Dalvik VM requires a class name
Finally, host-side dalvik vm is ready.
It just complain no given class.
cyanogen-ics$ ls /data/dalvik-cache/
tmp@cyanogen-ics@out@host@linux-x86@framework@apache-xml-
[email protected]
tmp@cyanogen-ics@out@host@linux-x86@framework@bouncycastle-
[email protected]
tmp@cyanogen-ics@out@host@linux-x86@framework@core-
[email protected]
Optimized DEX generated by “dexopt"
13. Agenda (1) How Virtual Machine Works
(2) Dalvik VM
(3) Utilities
15. What is Virtual Machine
• A virtual machine (VM) is a software implementation
of a machine (i.e. a computer) that executes programs
like a physical machine.
• Basic parts
– A set of registers
– A stack (optional)
– An execution environment
– A garbage-collected heap
– A constant pool
– A method storage area
– An instruction set
16. VM Types
• Based on its functionality
– System Virtual Machine
supports execution of a complete OS
– Process Virtual Machine
supports execution of a single process
• Based on its architecture
– Stack based VM (uses instructions to load in a
stack for execution)
– Register based VM (uses instructions to be
encoded in source and destination registers)
17. JVM Conceptual Architecture
Class
Classfile
Loader
Memory Space Automatic
memory
Native
Java method
manager
Method Java heap
stack heap
Address
Data and
Instruction
Instruction counter Native
Execution Native
and implicit Method
Engine LIbraries
registers Interface
18. Segment
javaframe
optop
method
Class fields
pc
others
{Variables locales }
vars
19. Segment
javaframe
vars
Environnement cotext
javaframe_i optop
optop_i
registres
20. Example: JVM
• Example Java source: Foo.java
class Foo {
public static void main(String[] args) {
System.out.println("Hello, world");
}
int calc(int a, int b) {
int c = 2 * (a + b);
return c;
}
}
22. Bytecode execution
c := 2 * (a + b)
• Example bytecode
– iconst 2
– iload a
– iload b
– iadd
– imul
– istore c
23. Example bytecode:
iconst 2
iload a a 42
iload b b 7
iadd c 0
imul 2
istore c
Computes: c := 2 * (a + b)
24. Example:
iconst 2
iload a a 42
iload b b 7
iadd c 0 42
imul 2
istore c
Computes: c := 2 * (a + b)
25. Example:
iconst 2
iload a a 42
iload b b 7 7
iadd c 0 42
imul 2
istore c
Computes: c := 2 * (a + b)
26. Example:
iconst 2
iload a a 42
iload b b 7
iadd c 0 49
imul 2
istore c
Computes: c := 2 * (a + b)
27. Example:
iconst 2
iload a a 42
iload b b 7
iadd c 0
imul 98
istore c
Computes: c := 2 * (a + b)
28. Example:
iconst 2
iload a a 42
iload b b 7
iadd c 98
imul
istore c
Computes: c := 2 * (a + b)
29. iadd in specification and implementation
③ add
value1 + value2
④ push
① pop
value2
② pop value1 +
value1 value2
case SVM_INSTRUCTION_IADD: {
/* instruction body */
jint value1 = stack[stack_size - 2].jint; ②
jint value2 = stack[--stack_size].jint; ①
stack[stack_size - 1].jint = value1 +
④ value2; ③
/* dispatch */
goto dispatch;
} Taken from SableVM
sablevm/src/libsablevm/instructions_switch.c
30. Example: Dalvik VM
$ dx --dex --output=Foo.dex Foo.class
$ dexdump -d Foo.dex
Processing 'Foo.dex'...
Opened 'Foo.dex', DEX version '035'
...
Virtual methods -
#0 : (in LFoo;)
name : 'calc'
type : '(II)I'
...
00018c: |[00018c] Foo.calc:(II)I
00019c: 9000 0203 |0000: add-int v0, v2, v3
0001a0: da00 0002 |0002: mul-int/lit8 v0, v0, #int 2
0001a4: 0f00 |0004: return v0
31. Java bytecode vs. Dalvik bytecode
(stack vs. register)
public int method(int i1, int i2)
{
int i3 = i1 * i2;
return i3 * 2;
}
.var 0 is “this” this: v1 (Ltest2;)
.var 1 is argument #1 parameter[0] : v2 (I)
.var 2 is argument #2 parameter[1] : v3 (I)
method public method(II)I
iload_1
iload_2 .method public method(II)I
imul mul-int v0,v2,v3
istore_3 mul-int/lit-8 v0,v0,2
iload_3 return v0
iconst_2 .end method
imul
ireturn
.end method
Java Dalvik
32. Dalvik is register based
• Dalvik uses 3-operand form, which it what a
processoractually uses
33. Dalvik is register based
• To execute "int foo = 1 + 2", the VM does:
– const-4 to store 1 into register 0
– add-int/lit8 to sum the value in register 0 (1) with the literal
2 and store the result intoregister 1 -- namely “foo”
34. Dalvik is register based
• This is only 2 dispatches, but Dalvik byte code is measured
into 2-byte units
• Java byte code was 4-bytes, the Dalvik byte code is actually
6-bytes
35. Code Size
• Generally speaking, the code size of register-based
VM instructions is larger than that of the
corresponding stack VM instructions
• On average, the register code is 25.05% larger than
the original stack code
36. Execution Time
• Register architecture requires an average of 47%
fewer executed VM instructions
Source: Virtual Machine Showdown: Stack Versus Registers
Yunhe Shi, David Gregg, Andrew Beatty, M. Anton Ertl
41. Best Dispatch Implementation
• The computed GOTO can be further optimized if
we re-write it in assembly.
• The code above uses typically two memory
reads. We can lay out all our bytecodes in
memory in such a way that each bytecode takes
exactly the same amount of memory - this way
we can calculate the address directly from the
index.
• Added benefit is the cacheline warm-up for
frequently used bytecodes.
43. Class 文件例子
import java.io.Serializable;
结构:
public class Foo implements Serializable { 声明与常量
public void bar() {
int i = 31;
if (i > 0) {
int j = 42;
代码:
} 语句与表达式
}
}
输出调试符号信息
编译 Java 源码
javac -g Foo.java
javap -c -s -l -verbose Foo
反编译 Class 文件
44. Class 文件例子
public Foo();
Signature: ()V
LineNumberTable:
方法 line 2: 0
元数据
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this LFoo;
Code:
字节码 Stack=1, Locals=1, Args_size=1
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return
45. Class 文件例子
public void bar();
Signature: ()V
LineNumberTable:
line 4: 0
line 5: 3
line 6: 7
line 8: 10
LocalVariableTable:
方法 Start Length Slot Name
元数据 Signature
10 0 2 j I
0 11 0 this Java 6 开始,有分支
LFoo; 控制流的方法会带有
3 8 1 i I StackMapTable,记
录每个基本块开头处
StackMapTable: number_of_entries = 1
frame_type = 252 /* append */
操作数栈的类型状态
offset_delta = 10
locals = [ int ]
Code:
Stack=1, Locals=3, Args_size=1
0: bipush 31
字节码 2: istore_1
3: iload_1
4: ifle 10
7: bipush 42
9: istore_2
10: return
46. 基于栈与基于寄存器的体系结构的区别
public class Demo {
public static void foo() {
int a = 1;
int b = 2;
int c = (a + b) * 5;
}
}
概念中的 Dalvik 虚拟机
概念中的 Java 虚拟机
Source: Java Program in Action——Java 程序的编译、加载与执行 , 莫枢
48. Dalvik VM
• Dalvik architecture is register based
• Optimized to use less space
• Execute its own Dalvik byte code rather than Java
byte code
• Class Library taken from Apache Harmony
– A compatible, independent implementation of the
Java SE 5 JDK under the Apache License v2
– A community-developed modular runtime (VM and
class library) architecture. (deprecated now)
49. Reasons to Choose Dalvik
• Dalvik (Register based) take average 47 % less
executed VM instruction then JVM (Stack based).
• Register code is 25% larger than the corresponding
stack code.
• This increased cost of fetching more VM instructions
due to larger code size involves only 1.07% extra
real machine loads per VM instruction. Which is
negligible.
• Some Marketing Reasons too
– Oracle lawsuit against Google
50. Dalvik ARM CPU
Memory(DDR)
hello.JAVA Write
(Source) back
“Stack” Section Excute
JAVAC (ARM
(Compiler) code) Memory
Reg
“BSS” Section access
Decode excute
hello.class “Data” Section (Number)
DX Decode
(Compiler)
“Text” Section Fetch PC fetch
Hello.dexLoading Excute Interpreter
(Dex)
51. Constant Pool:
References to other classes
Method names
Numerical constants
Class Definition:
Access flags
Class names
Data:
Method code
Info related to methods
Variables
52. Dalvik Architecture
• Register architecture
• 216 available registers
• Instruction set has 218 opcodes
– JVM: 200 opcodes
• 30% fewer instructions, but 35% larger code size
(bytes) compared to JVM
53. Constant Pool
• Dalvik
– Single pool
– dx eliminates some constants by inlining their
values directly into the bytecode
• JVM
– Multiple
54. Primitive Types
• Ambiguous primitive types
– Dalvik
int/float, long/double use the same opcodes
does not distinguish : int/float, long/double, 0/null.
– JVM
Different: JVM is typed
• Null references
– Dalvik
Not specify a null type
Use zero value
55. Object Reference
• Comparison of object references
• Dalvik
– Comparison between two integers
– Comparison of integer and zero
• JVM
– if_acmpeq / if_acmpne
– ifnull / ifnonnull
56. Dalvik
• Storage of primitive types in arrays
• Dalvik
– Ambiguous opcodes
– aget for int/float, aget-wide for long/double
57. Dalvik
• Dalvik uses annotation to store:
– signature
– inner class
– Interface
– Throw statement.
• Dalvik is more compact, average of 30% less
instructions than JVM.
61. Shared constant pool
• Zapper.java
public interface Zapper {
public String zap(String s, Object o);
}
public class Blort implements Zapper {
public String zap(String s, Object o) { … }
}
public class ZapUser {
public void useZap(Zapper z) { z.zap(...); }
}
70. Efficient Interpreter in Android
• There are 3 forms of Dalvik
– dexopt: optimized DEX
– Zygote
– libdvm + JIT
71. Efficient Interpreter: Optimized DEX
• Apply platform-specific optimizations:
– specific bytecode
Common operations like String.length
– vtables for methods
have their own special instruction
– offsets for attributes execute-inline
VM has special code just for those
– method inlining
common operations
• Example: Things like calling the Object’s
constructor - optimized to nothing
because the method is empty
73. • Virtual (non-private, non-constructor, non-static methods)
invoke-virtual <symbolic method name> → invoke-virtual-quick <vtable index>
Before:
invoke-virtual {v0, v1},
Ljava/io/PrintStream;.println:(Ljava/lang/String;)V
After:
+invoke-virtual-quick {v0, v1}, [002c] // vtable #002c
• Can change invoke-virtual to invoke-virtual-quick
– because we know the layout of the v-table
74. DEX Optimizations
• Before being executed by Dalvik, DEX files are optimized.
– Normally it happens before the first execution of code from the DEX file
– Combined with the bytecode verification
– In case of DEX files from APKs, when the application is launched for
the first time.
• Process
– The dexopt process (which is actually a backdoor of Dalvik) loads the
DEX, replaces certain instructions with their optimized counterparts
– Then writes the resulting optimized DEX (ODEX) file into the
/data/dalvik-cache directory
– It is assumed that the optimized DEX file will be executed on the same
VM that optimized it. ODEX files are NOT portable across VMs.
76. Meaning of DEX Optimizations
• Sets byte ordering and structure alignment
• Aligns the member variables to 32-bits / 64-bits
• boundary (the structures in the DEX/ODEX file itself
are 32-bit aligned)
• Significant optimizations because of the elimination
of symbolic field/method lookup at runtime.
• Aid of Just-In-Time compiler
77. Efficient Interpreter: Zygote
is a VM process that starts at system boot time.
• Boot-loader load kernel and start init process.
• Starts Zygote process
• Initializes a Dalvik VM which preloads and pre-
initializes core library classes.
• Keep in an idle state by system and wait for socket
requests.
• Once an application execution request occur, Zygote
forks itself and create new process with pre-loaded
Dalvik VM.
79. Efficient Interpreter:
Just-In-Time Compilation
• Just-in-time compilation (JIT), also known as
dynamic translation, is a technique for improving
the runtime performance of a computer program.
• A hybrid approach, with translation occurring
continuously, as with interpreters, but with caching of
translated code to minimize performance
degradation
80. JIT Types
• When to compile
– install time, launch time, method invoke time, instruction
fetch time
• What to compile
– whole program, shared library, page, method, trace, single
instruction
• Android needs a combination that meet the needs of a mobile
– Minimal additional memory usage
– Coexist with Dalvik’s container-based security model
– Quick delivery of performance boost
– Smooth transition between interpretation & compiled code
81. Android system_server example
Source: Google I/O 2010 - A JIT Compiler for Android's Dalvik VM
• Compiled Code takes up memory - want the benefits of JIT with small memory footprint
• Small amount compilation provides a big benefit
• In test program, 4.5MB of byte code - 8% of methods: 390K was hot; 25% of code in
methods was hot - so 2% in the end
• 90% of time in 10% of the code may be generous
82. Trace JIT
• Trace : String of Instructions
• Minimizing memory usage critical for mobile devices
• Important to deliver performance boost quickly
– User might give up on new app if we wait too long to JIT
• Leave open the possibility of supplementing with method
based JIT
– The two styles can co-exist
– A mobile device looks more like a server when it's
plugged in
– Best of both worlds
• Trace JIT when running on battery
• Method JIT in background while charging
84. Dalvik JIT Overview
• Tight integration with interpreter
– Useful to think of the JIT as an extension of the
interpreter
• Interpreter profiles and triggers trace selection mode
when a potential trace head goes hot
• Trace request is built during interpretation
• Trace requests handed off to compiler thread, which
compiles and optimizes into native code
• Compiled traces chained together in translation
cache
85. Dalvik JIT Features
• Per-process translation caches (sharing only within
security sandboxes)
• Simple traces - generally 1 to 2 basic blocks long
• Local optimizations
– Register promotion
– Load/store elimination
– Redundant null-check elimination
• Loop optimizations
– Simple loop detection
– Invariant code motion
– Induction variable optimization
99. Dexmaker: bytecode generator
http://code.google.com/p/dexmaker/
• A Java-language API for doing compile time or
runtime code generation targeting the Dalvik VM.
Unlike cglib or ASM, this library creates Dalvik .dex
files instead of Java .class files.
• It has a small, close-to-the-metal API. This API
mirrors the Dalvik bytecode specification giving you
tight control over the bytecode emitted.
• Code is generated instruction-by-instruction; you
bring your own abstract syntax tree if you need one.
And since it uses Dalvik's dx tool as a backend, you
get efficient register allocation and regular/wide
instruction selection for free.
100. Reference
• Dalvik VM Internals, Dan Bornstein (2008)
http://sites.google.com/site/io/dalvik-vm-internals
• Analysis of Dalvik Virtual Machine and Class Path Library,
Institute of Management SciencesPeshawar, Pakistan (2009)
http://serg.imsciences.edu.pk
• Reconstructing Dalvik applications, Marc Schonefeld (2009)
• A Study of Android Application Security, William Enck,
Damien Octeau, Patrick McDaniel, and Swarat Chaudhuri (2011)
• dalvik の GC をのぞいてみた , @akachochin (2011)
• 《 Android 惡意代碼分析教程》 , Claud Xiao (2012)
http://code.google.com/p/amatutor/
• XXX