For new age touch-based embedded devices, Android is becoming a popular OS going beyond mobile phones. With its roots from Embedded Linux, Android framework offers benefits in terms of rich libraries, open-source and multi-device support. Emertxe’s hands-on Embedded Android Training Course is designed to customize, build and deploy custom Embedded OS on ARM target. Rich set of projects will make your learning complete.
1) Verified boot is the process of assuring users of the integrity of software running on a device by reducing risks from malware and preventing rollbacks to vulnerable past versions. It uses hashing, public key cryptography, and tamper-evident storage.
2) Android Verified Boot 2.0 (AVB) is Google's recommended method for verified boot integration. It uses a signed VBMeta structure containing hashes, hashtrees and rollback indexes to verify the integrity of partitions before booting.
3) AVB supports features like A/B partitions, locked/unlocked device states, and delegates verification authority through chained partitions. It interacts with bootloaders, uses avbtool to generate signatures,
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.
Embedded Android system development workshop is focused on integrating new device with Android framework. Our hands-on approach makes Emertxe as the best institute to learn android system development training. This workshop deep dives into Android porting, Android Hardware Abstraction Layer (HAL), Android Services and Linux device driver ecosystem. This workshop based training program will enable you to efficiently integrate new hardware with Android HAL / Framework.
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.
Android Things is the latest attempt from Google to connect the dots between the cloud and devices by introducing an OS that is exclusively built for IoT devices. Initially announced as project Brillo, Android Things helps developers to build devices faster and enable them integrate with cloud services. This presentation traces the architectural aspects of Android Things by connecting it back with Embedded Linux, Embedded Android and Brillo.
There is a surge in number of sensors / devices that are getting connected under the umbrella of Internet-Of-Things (IoT). These devices need to be integrated into the Android system and accessed via applications, which is covered in the course. Our Android system development course curriculum over weekends with practicals ensures you learn all critical components to get started.
Linux is an open-source operating system based on the Unix model. It can run on a variety of hardware and has thousands of available programs. The document discusses the history and development of Linux from its origins in the 1960s through its creation by Linus Torvalds in 1991. It also covers key Linux concepts like kernels, processes, threads, file systems, and boot processes. Community links are provided for learning more about the Linux kernel, drivers, boot loader, and file systems.
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.
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
This document provides an overview of the native Android user-space environment, including:
1) The filesystem layout and key directories like /system, /data, and /vendor.
2) How the build system determines where files are placed.
3) The adb debugging tool and its capabilities.
4) Common command line tools and properties.
5) The init process and ueventd daemon.
6) Libraries like Bionic and integration options for legacy systems.
Android Audio HAL – Audio Architecture – Audio HAL interface – Audio Policy – Audio HAL compilation & verification – Overview of Tinyalsa
Android Video HAL – Camera Architecture – Overview of camera HAL interface – Overview of V4L2 – Enabling V4l2 in kernel – Camera HAL compilation and verification
EGL is an interface between Khronos rendering APIs (such as OpenGL and OpenGL ES) and the underlying native platform windowing system. It handles graphics context management, surface/buffer creation and binding, and rendering synchronization. EGL provides mechanisms for creating on-screen and off-screen rendering surfaces and graphics contexts that store OpenGL state. Key EGL functions include eglGetDisplay(), eglInitialize(), eglChooseConfig(), eglCreateWindowSurface(), and eglCreatePbufferSurface().
This presentation is prepared for anyone that needs to basic information about Microsoft virtualization solutions and VDI solutions on Hyper-V, Remote protocols and compatible devices.
Embedded Android System Development - Part II talks about Hardware Abstraction Layer (HAL). HAL is an interfacing layer through which Android service can place a request to device. Uses functions provided by Linux system to service the request from android framework. A C/C++ layer with purely vendor specific implementation. Packaged into modules (.so) file & loaded by Android system at appropriate time
Virtualization using VMWare WorkstationHitesh Gupta
Virtualization allows multiple operating systems to run concurrently on a single physical machine. VMware is a leading virtualization software that allows this. The document discusses virtualization concepts like emulation, virtual machines, types of virtualization. It provides an overview of VMware Workstation software for desktop virtualization. Steps for installing Workstation and creating a virtual machine are outlined. Networking modes for virtual machines are explained. The document also discusses how virtualization intersect with cloud computing. It presents a case study of how Oxford University implemented a private cloud using VMware virtualization to provide database as a service for researchers.
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.
Android 10 includes several new features and improvements including enhanced privacy and security features, expanded digital wellbeing tools, better support for new hardware, and under-the-hood optimizations. Key changes involve moving the root file system to the system image partition, adding new kernel utilities to help with ABI compatibility, and introducing services like SystemSuspend HIDL to leverage benefits of the Android HIDL infrastructure.
The document discusses Android over-the-air (OTA) updates, including the update mechanism, update packages, and the recovery console. It describes how OTA updates work in Android, from downloading an update package to verifying and applying the updates. It also discusses the AOSP components involved like the updater binary, edify scripting language, and recovery console. Finally, it covers creating an OTA application to check and download updates and rebooting into recovery to apply them.
This document provides an overview of Android's HIDL (Hardware Interface Definition Language). It begins with introductions to HIDL's goals of providing versioned hardware interface definitions and how it fits into Android's architecture. It then covers basics like HAL's traditional C-based implementation, HIDL's similarities to AIDL, and links to documentation. The document dives deeper into HIDL's architecture including the JNI, HIDL, and HIDL glue layers. It walks through an example of lights HAL implementation. Finally, it discusses adding a new HIDL interface, the supporting infrastructure, and acknowledges diagram sources.
Treble introduces several changes to standardize and streamline the Android upgrade process for OEMs and carriers. These include defining hardware interfaces with HIDL, restricting vendor customization with VNDK, and adding a vendor interface and test suite (VINTF and VTS) to validate compatibility. The goal is to make upgrades easier, faster and less costly for manufacturers by decoupling the Android framework from vendor implementation details.
This presentation covers the working model about Process, Thread, system call, Memory operations, Binder IPC, and interactions with Android frameworks.
The document discusses the Android booting process. It begins with the boot ROM and boot loader which initialize hardware and load the kernel image. The kernel then initializes drivers and loads init, which sets up the environment and mounts partitions. Init starts the zygote process, which preloads classes. System servers like the activity manager and power manager are then started via zygote. Once all servers are running, Android broadcasts an intent to indicate the boot process is complete. The boot sequence involves the bootloader, kernel, init, zygote and system servers working together to start the Android system.
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
1) The document provides an overview of using and customizing the Android framework, covering topics like kickstarting the framework, utilities and commands, system services internals, and creating custom services.
2) It describes the core building blocks of the framework, like services, Dalvik, and the boot process. It also covers utilities like am, pm, and dumpsys.
3) The document discusses native daemons like servicemanager and installd. It explains how to observe the system server and interact with services programmatically.
This document provides an overview of Android internals through a series of topics:
1. It describes key Android concepts like components, intents, and the manifest file.
2. It outlines the overall Android architecture including system startup processes like the bootloader, kernel, init, zygote and system server.
3. It covers various aspects of the Android system like the Linux kernel customizations, native user-space environment, Dalvik VM, and Java Native Interface.
4. It also profiles important system-level components like the system server, activity manager, and Binder IPC mechanism.
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.
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.
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
This document provides an overview of the native Android user-space environment, including:
1) The filesystem layout and key directories like /system, /data, and /vendor.
2) How the build system determines where files are placed.
3) The adb debugging tool and its capabilities.
4) Common command line tools and properties.
5) The init process and ueventd daemon.
6) Libraries like Bionic and integration options for legacy systems.
Android Audio HAL – Audio Architecture – Audio HAL interface – Audio Policy – Audio HAL compilation & verification – Overview of Tinyalsa
Android Video HAL – Camera Architecture – Overview of camera HAL interface – Overview of V4L2 – Enabling V4l2 in kernel – Camera HAL compilation and verification
EGL is an interface between Khronos rendering APIs (such as OpenGL and OpenGL ES) and the underlying native platform windowing system. It handles graphics context management, surface/buffer creation and binding, and rendering synchronization. EGL provides mechanisms for creating on-screen and off-screen rendering surfaces and graphics contexts that store OpenGL state. Key EGL functions include eglGetDisplay(), eglInitialize(), eglChooseConfig(), eglCreateWindowSurface(), and eglCreatePbufferSurface().
This presentation is prepared for anyone that needs to basic information about Microsoft virtualization solutions and VDI solutions on Hyper-V, Remote protocols and compatible devices.
Embedded Android System Development - Part II talks about Hardware Abstraction Layer (HAL). HAL is an interfacing layer through which Android service can place a request to device. Uses functions provided by Linux system to service the request from android framework. A C/C++ layer with purely vendor specific implementation. Packaged into modules (.so) file & loaded by Android system at appropriate time
Virtualization using VMWare WorkstationHitesh Gupta
Virtualization allows multiple operating systems to run concurrently on a single physical machine. VMware is a leading virtualization software that allows this. The document discusses virtualization concepts like emulation, virtual machines, types of virtualization. It provides an overview of VMware Workstation software for desktop virtualization. Steps for installing Workstation and creating a virtual machine are outlined. Networking modes for virtual machines are explained. The document also discusses how virtualization intersect with cloud computing. It presents a case study of how Oxford University implemented a private cloud using VMware virtualization to provide database as a service for researchers.
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.
Android 10 includes several new features and improvements including enhanced privacy and security features, expanded digital wellbeing tools, better support for new hardware, and under-the-hood optimizations. Key changes involve moving the root file system to the system image partition, adding new kernel utilities to help with ABI compatibility, and introducing services like SystemSuspend HIDL to leverage benefits of the Android HIDL infrastructure.
The document discusses Android over-the-air (OTA) updates, including the update mechanism, update packages, and the recovery console. It describes how OTA updates work in Android, from downloading an update package to verifying and applying the updates. It also discusses the AOSP components involved like the updater binary, edify scripting language, and recovery console. Finally, it covers creating an OTA application to check and download updates and rebooting into recovery to apply them.
This document provides an overview of Android's HIDL (Hardware Interface Definition Language). It begins with introductions to HIDL's goals of providing versioned hardware interface definitions and how it fits into Android's architecture. It then covers basics like HAL's traditional C-based implementation, HIDL's similarities to AIDL, and links to documentation. The document dives deeper into HIDL's architecture including the JNI, HIDL, and HIDL glue layers. It walks through an example of lights HAL implementation. Finally, it discusses adding a new HIDL interface, the supporting infrastructure, and acknowledges diagram sources.
Treble introduces several changes to standardize and streamline the Android upgrade process for OEMs and carriers. These include defining hardware interfaces with HIDL, restricting vendor customization with VNDK, and adding a vendor interface and test suite (VINTF and VTS) to validate compatibility. The goal is to make upgrades easier, faster and less costly for manufacturers by decoupling the Android framework from vendor implementation details.
This presentation covers the working model about Process, Thread, system call, Memory operations, Binder IPC, and interactions with Android frameworks.
The document discusses the Android booting process. It begins with the boot ROM and boot loader which initialize hardware and load the kernel image. The kernel then initializes drivers and loads init, which sets up the environment and mounts partitions. Init starts the zygote process, which preloads classes. System servers like the activity manager and power manager are then started via zygote. Once all servers are running, Android broadcasts an intent to indicate the boot process is complete. The boot sequence involves the bootloader, kernel, init, zygote and system servers working together to start the Android system.
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
1) The document provides an overview of using and customizing the Android framework, covering topics like kickstarting the framework, utilities and commands, system services internals, and creating custom services.
2) It describes the core building blocks of the framework, like services, Dalvik, and the boot process. It also covers utilities like am, pm, and dumpsys.
3) The document discusses native daemons like servicemanager and installd. It explains how to observe the system server and interact with services programmatically.
This document provides an overview of Android internals through a series of topics:
1. It describes key Android concepts like components, intents, and the manifest file.
2. It outlines the overall Android architecture including system startup processes like the bootloader, kernel, init, zygote and system server.
3. It covers various aspects of the Android system like the Linux kernel customizations, native user-space environment, Dalvik VM, and Java Native Interface.
4. It also profiles important system-level components like the system server, activity manager, and Binder IPC mechanism.
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.
The document discusses the Dalvik virtual machine (VM) used in Android. It begins by explaining what a VM is and the basic parts that make up a VM. It then discusses the differences between stack-based and register-based VMs, noting that Dalvik uses a register-based architecture. The document explains that Dalvik was chosen for Android because it executes faster than Java VM and uses less memory. It also describes how Java bytecodes are converted to Dalvik bytecodes and discusses optimizations like shared constant pools and just-in-time compilation that improve Dalvik's performance.
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.
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.
Caching for Performance Masterclass: Caching at ScaleScyllaDB
Weighing caching considerations for use cases with different technical requirements and growth expectations.
- Request coalescing
- Negative sharding
- Rate limiting
- Sharding and scaling
Combining Lexical and Semantic Search with Milvus 2.5Zilliz
In short, lexical search is a way to search your documents based on the keywords they contain, in contrast to semantic search, which compares the similarity of embeddings. We’ll be covering:
Why, when, and how should you use lexical search
What is the BM25 distance metric
How exactly does Milvus 2.5 implement lexical search
How to build an improved hybrid lexical + semantic search with Milvus 2.5
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIASrivaanchi Nathan
This business intelligence report, "The Big Ten Biopharmaceutical MNCs: Global Capability Centers in India", provides an in-depth analysis of the operations and contributions of the Global Capability Centers (GCCs) of ten leading biopharmaceutical multinational corporations in India. The report covers AstraZeneca, Bayer, Bristol Myers Squibb, GlaxoSmithKline (GSK), Novartis, Sanofi, Roche, Pfizer, Novo Nordisk, and Eli Lilly. In this report each company's GCC is profiled with details on location, workforce size, investment, and the strategic roles these centers play in global business operations, research and development, and information technology and digital innovation.
How to teach M365 Copilot and M365 Copilot Chat prompting to your colleagues. Presented at the Advanced Learning Institute's "Internal Communications Strategies with M365" event on February 27, 2025. Intended audience: Internal Communicators, User Adoption Specialists, IT.
Predictive vs. Preventive Maintenance — Which One is Right for Your FactoryDiagsense ltd
Efficient maintenance is the backbone of any manufacturing operation. It ensures that machinery runs smoothly, minimizes downtime and optimizes overall productivity. Earlier, factories have relied on preventive maintenance but with advancements in technology, Manufacturing PdM Solutions is gaining traction. The question is—which one is the right fit for your factory? Let’s break it down.
Mastering ChatGPT & LLMs for Practical Applications: Tips, Tricks, and Use CasesSanjay Willie
Our latest session with Astiostech covered how to unlock the full potential of ChatGPT and LLMs for real-world use!
✅ Key Takeaways:
🔹 Effective Prompting: Crafting context-specific, high-quality prompts for optimal AI responses.
🔹 Advanced ChatGPT Features: Managing system prompts, conversation memory, and file uploads.
🔹 Optimizing AI Outputs: Refining responses, handling large texts, and knowing when fine-tuning is needed.
🔹 Competitive Insights: Exploring how ChatGPT compares with other AI tools.
🔹 Business & Content Use Cases: From summarization to SEO, sales, and audience targeting.
💡 The session provided hands-on strategies to make AI a powerful tool for content creation, decision-making, and business growth.
🚀 Are you using AI effectively in your workflow? Let’s discuss how it can improve efficiency and creativity!
#AI #ChatGPT #PromptEngineering #ArtificialIntelligence #LLM #Productivity #Astiostech
This is session #3 of the 5-session online study series with Google Cloud, where we take you onto the journey learning generative AI. You’ll explore the dynamic landscape of Generative AI, gaining both theoretical insights and practical know-how of Google Cloud GenAI tools such as Gemini, Vertex AI, AI agents and Imagen 3.
AI in Medical Diagnostics – The Future of HealthcareVadim Nareyko
💡 What You’ll Learn:
• What is AI in medical diagnostics and how it works?
• How AI enhances accuracy, speed, and accessibility in disease detection.
• Real-world examples from leading innovators like Google Health, IBM Watson, and Siemens Healthineers.
• The cutting-edge AI technologies driving this transformation, including computer vision, natural language processing, and federated learning.
• The challenges, opportunities, and future trends in AI-powered diagnostics.
________________________________________
🔍 Why AI in Healthcare Matters:
Traditional diagnosis relies heavily on manual interpretation, making it time-consuming and sometimes prone to human error. AI-driven diagnostic systems analyze vast amounts of medical data faster and more accurately, helping doctors detect diseases in their early stages.
From automated radiology analysis to AI-assisted pathology and real-time patient monitoring, these technologies are revolutionizing healthcare, telemedicine, and personalized treatment.
Data-Driven Public Safety: Reliable Data When Every Second CountsSafe Software
When every second counts, you need access to data you can trust. In this webinar, we’ll explore how FME empowers public safety services to streamline their operations and safeguard communities. This session will showcase workflow examples that public safety teams leverage every day.
We’ll cover real-world use cases and demo workflows, including:
Automating Police Traffic Stop Compliance: Learn how the City of Fremont meets traffic stop data standards by automating QA/QC processes, generating error reports – saving over 2,800 hours annually on manual tasks.
Anonymizing Crime Data: Discover how cities protect citizen privacy while enabling transparent and trustworthy open data sharing.
Next Gen 9-1-1 Integration: Explore how Santa Clara County supports the transition to digital emergency response systems for faster, more accurate dispatching, including automated schema mapping for address standardization.
Extreme Heat Alerts: See how FME supports disaster risk management by automating the delivery of extreme heat alerts for proactive emergency response.
Our goal is to provide practical workflows and actionable steps you can implement right away. Plus, we’ll provide quick steps to find more information about our public safety subscription for Police, Fire Departments, EMS, HAZMAT teams, and more.
Whether you’re in a call center, on the ground, or managing operations, this webinar is crafted to help you leverage data to make informed, timely decisions that matter most.
UiPath Agentic Automation Capabilities and OpportunitiesDianaGray10
Learn what UiPath Agentic Automation capabilities are and how you can empower your agents with dynamic decision making. In this session we will cover these topics:
What do we mean by Agents
Components of Agents
Agentic Automation capabilities
What Agentic automation delivers and AI Tools
Identifying Agent opportunities
❓ If you have any questions or feedback, please refer to the "Women in Automation 2025" dedicated Forum thread. You can find there extra details and updates.
EaseUS Partition Master Crack 2025 + Serial Keykherorpacca127
https://ncracked.com/7961-2/
Note: >> Please copy the link and paste it into Google New Tab now Download link
EASEUS Partition Master Crack is a professional hard disk partition management tool and system partition optimization software. It is an all-in-one PC and server disk management toolkit for IT professionals, system administrators, technicians, and consultants to provide technical services to customers with unlimited use.
EASEUS Partition Master 18.0 Technician Edition Crack interface is clean and tidy, so all options are at your fingertips. Whether you want to resize, move, copy, merge, browse, check, convert partitions, or change their labels, you can do everything with a few clicks. The defragmentation tool is also designed to merge fragmented files and folders and store them in contiguous locations on the hard drive.
Leadership u automatizaciji: RPA priče iz prakse!UiPathCommunity
Dobrodošli na "AI Powered Automation Leadership Talks", online događaj koji okuplja senior lidere i menadžere iz različitih industrija kako bi podelili svoja iskustva, izazove i strategije u oblasti RPA (Robotic Process Automation). Ovaj događaj pruža priliku da zavirite u način razmišljanja ljudi koji donose ključne odluke u automatizaciji i liderstvu.
📕 Kroz panel diskusiju sa tri izuzetna stručnjaka, istražićemo:
Kako uspešno započeti i skalirati RPA projekte u organizacijama.
Koji su najveći izazovi u implementaciji RPA-a i kako ih prevazići.
Na koje načine automatizacija menja radne procese i pomaže timovima da ostvare više.
Bez obzira na vaše iskustvo sa UiPath-om ili RPA uopšte, ovaj događaj je osmišljen kako bi bio koristan svima – od menadžera do tehničkih lidera, i svima koji žele da unaprede svoje razumevanje automatizacije.
Pridružite nam se i iskoristite ovu jedinstvenu priliku da naučite od onih koji vode automatizaciju u svojim organizacijama. Pripremite svoja pitanja i inspiraciju za sledeće korake u vašoj RPA strategiji!
DealBook of Ukraine: 2025 edition | AVentures CapitalYevgen Sysoyev
The DealBook is our annual overview of the Ukrainian tech investment industry. This edition comprehensively covers the full year 2024 and the first deals of 2025.
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