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.
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaJAX London
2011-11-02 | 03:45 PM - 04:35 PM |
Android Activities can possess one of four launch modes and one of many activity tasks. We will explore how your choices of launch modes and tasks affect your Applications back stack history and what will happen behind the scenes. After this talk you will confidently be able to wield the best launch modes for your apps activities in every situation!
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.
The document discusses the basic components of an Android app. It explains that an Android app consists of components like activities, services, broadcast receivers, and content providers. Activities provide the main user interface and common ones include launching the app and navigating within it. The app manifest file defines these components. The document also covers activities and intents, explaining how activities are launched via explicit and implicit intents and how data can be passed between activities.
Binder is what differentiates Android from Linux, it is most important internal building block of Android, it is a subject every Android programmer should be familiar with
Kotlin Coroutines allow for writing asynchronous non-blocking code using coroutines and suspending functions. Key features include cooperative multitasking on a single thread, using coroutines instead of threads, and dispatchers to control coroutine execution. Examples demonstrate loading data asynchronously for UI, updating multiple objects concurrently using coroutines, and checking server validity in a non-blocking suspending function.
Binder IPC allows processes to communicate by sharing common interface definitions. A client obtains a local proxy object and invokes methods which are translated to calls on a remote service object via the binder driver. Services register with the ServiceManager and clients obtain remote service objects by name. Calls involve parceling requests into ioctl calls between proxy helpers and remote helpers.
- Foreground services run in the foreground and can avoid being recycled by the Android system when low on resources. They can be interacted with by the user through notifications.
- Started services run indefinitely in the background until stopped or destroyed by the system. They are launched by other app components like activities or broadcast receivers.
- Bound services can return results and interact with the component that started them, unlike started services. They allow sending data to the launching component.
- IPC allows two processes or apps to communicate by passing data. On Android, processes cannot access each other's memory directly, so IPC provides channels for communication using messengers or AIDL.
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaJAX London
2011-11-02 | 03:45 PM - 04:35 PM |
Android Activities can possess one of four launch modes and one of many activity tasks. We will explore how your choices of launch modes and tasks affect your Applications back stack history and what will happen behind the scenes. After this talk you will confidently be able to wield the best launch modes for your apps activities in every situation!
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.
The document discusses the basic components of an Android app. It explains that an Android app consists of components like activities, services, broadcast receivers, and content providers. Activities provide the main user interface and common ones include launching the app and navigating within it. The app manifest file defines these components. The document also covers activities and intents, explaining how activities are launched via explicit and implicit intents and how data can be passed between activities.
Binder is what differentiates Android from Linux, it is most important internal building block of Android, it is a subject every Android programmer should be familiar with
Kotlin Coroutines allow for writing asynchronous non-blocking code using coroutines and suspending functions. Key features include cooperative multitasking on a single thread, using coroutines instead of threads, and dispatchers to control coroutine execution. Examples demonstrate loading data asynchronously for UI, updating multiple objects concurrently using coroutines, and checking server validity in a non-blocking suspending function.
Binder IPC allows processes to communicate by sharing common interface definitions. A client obtains a local proxy object and invokes methods which are translated to calls on a remote service object via the binder driver. Services register with the ServiceManager and clients obtain remote service objects by name. Calls involve parceling requests into ioctl calls between proxy helpers and remote helpers.
- Foreground services run in the foreground and can avoid being recycled by the Android system when low on resources. They can be interacted with by the user through notifications.
- Started services run indefinitely in the background until stopped or destroyed by the system. They are launched by other app components like activities or broadcast receivers.
- Bound services can return results and interact with the component that started them, unlike started services. They allow sending data to the launching component.
- IPC allows two processes or apps to communicate by passing data. On Android, processes cannot access each other's memory directly, so IPC provides channels for communication using messengers or AIDL.
A service in Android runs in the background without a user interface. It can be started and stopped to perform long-running operations like playing audio. A service is not a separate process or a thread but allows work to be done in the background even when the user is not interacting with the app. The document provides an example service app that runs a background service displaying a notification every 5 seconds until stopped. It demonstrates starting and stopping the service from an activity and handling the service lifecycle through onCreate(), onStart(), and onDestroy() methods.
YouTube Link: https://youtu.be/9XMt2hChbRo
** Edureka Online Training: https://www.edureka.co/ **
In this edureka PPT, Flutter tutorial, you will learn about google's cross-platform mobile application development framework. You will also learn to make a basic app using flutter at the end of this video.
The following topics are discussed in this PPT
Mobile Application Development
What is Flutter?
Why learn Flutter?
Flutter Architecture
Types of Widgets
How Flutter Compiles
Flutter Installation
Writing Our First Flutter Application
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
SurfaceFlinger is a vital system service in Android system, responsible for the composting all the application and system layer and displaying them. In this slide,we looked in detail how surfaceFlinger was designed from Design Pattern's perspective.
This Presentation talks about various aspects of managing the Activity Backstack.
Please note this was prepared last year but most of the concepts are still relevant
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.
This presentation covers the working model about Process, Thread, system call, Memory operations, Binder IPC, and interactions with Android frameworks.
The document discusses using Node.js events and the EventEmitter class. It shows examples of creating EventEmitters, adding event listeners, emitting events, checking the number of listeners, and emitting events to all listeners. It also shows an example of creating a class that inherits from EventEmitter to add event-driven functionality for reading a file.
This document introduces Android AIDL (Android Interface Definition Language), which allows for inter-process communication (IPC) between Android applications. It discusses writing AIDL interface and implementation files to define service interfaces and how to use AIDL to allow an app's services to be bound by other apps. The key aspects covered are the supported data types in AIDL, how AIDL addresses IPC memory issues, and how to generate AIDL interface implementations to make remote calls between processes using AIDL.
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 services allow long-running tasks to perform work in the background independently of an application's user interface. There are two main types of services: started services which can perform operations indefinitely even if the starting component is destroyed, and bound services which offer a client-server interface between a component and the service. Services must be started with startService() or bound to with bindService() and have lifecycle callback methods like onStartCommand(), onBind(), onCreate(), and onDestroy(). The IntentService class simplifies started service implementation. Bound services can expose interfaces using Binder, Messenger, or AIDL to allow inter-process communication.
The document summarizes key aspects of using JavaScript with the DOM:
1) The DOM represents the document as nodes that can be accessed and manipulated with JavaScript. Common methods are getElementById() and getElementsByTagName() to select nodes, and createElement() to generate new nodes.
2) Events allow JavaScript to react to user actions. Event handlers can be assigned to nodes using onclick attributes or addEventListener(). Events bubble up the DOM tree by default but can be stopped from propagating with stopPropagation().
3) The this keyword refers to the "owner" or context of the executing function, such as the HTML element to which an event handler is assigned. Understanding this is important for manipulating nodes from
This document provides an overview of ExpressJS, a web application framework for Node.js. It discusses using Connect as a middleware framework to build HTTP servers, and how Express builds on Connect by adding functionality like routing, views, and content negotiation. It then covers basic Express app architecture, creating routes, using views with different template engines like Jade, passing data to views, and some advanced topics like cookies, sessions, and authentication.
This document provides an introduction and overview of Node.js, including what Node.js is, its architecture and basics, how to write "Hello World" programs in Node.js and Express, how to use modules, errors, middleware, routers, Mongoose and MongoDB for databases, and the MEAN stack. It also describes a tutorial for building a backend API with Node.js, Express, Mongoose and MongoDB.
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.
The document discusses different types of intents in Android: explicit intents explicitly define which component to call, implicit intents allow Android to search for a component to handle the intent, and data can be sent between intents using extras. It also covers using intents to start activities without a result, and starting sub-activities for result data using startActivityForResult().
This set of slides introduces the basics of the Android development framework and mobile development in general. First, a brief overview on the history of mobile development is introduced. Then, the architecture of the Android platform is discussed, commenting on the role and functionalities of each architectural layer.
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.
A service in Android runs in the background without a user interface. It can be started and stopped to perform long-running operations like playing audio. A service is not a separate process or a thread but allows work to be done in the background even when the user is not interacting with the app. The document provides an example service app that runs a background service displaying a notification every 5 seconds until stopped. It demonstrates starting and stopping the service from an activity and handling the service lifecycle through onCreate(), onStart(), and onDestroy() methods.
YouTube Link: https://youtu.be/9XMt2hChbRo
** Edureka Online Training: https://www.edureka.co/ **
In this edureka PPT, Flutter tutorial, you will learn about google's cross-platform mobile application development framework. You will also learn to make a basic app using flutter at the end of this video.
The following topics are discussed in this PPT
Mobile Application Development
What is Flutter?
Why learn Flutter?
Flutter Architecture
Types of Widgets
How Flutter Compiles
Flutter Installation
Writing Our First Flutter Application
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
SurfaceFlinger is a vital system service in Android system, responsible for the composting all the application and system layer and displaying them. In this slide,we looked in detail how surfaceFlinger was designed from Design Pattern's perspective.
This Presentation talks about various aspects of managing the Activity Backstack.
Please note this was prepared last year but most of the concepts are still relevant
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.
This presentation covers the working model about Process, Thread, system call, Memory operations, Binder IPC, and interactions with Android frameworks.
The document discusses using Node.js events and the EventEmitter class. It shows examples of creating EventEmitters, adding event listeners, emitting events, checking the number of listeners, and emitting events to all listeners. It also shows an example of creating a class that inherits from EventEmitter to add event-driven functionality for reading a file.
This document introduces Android AIDL (Android Interface Definition Language), which allows for inter-process communication (IPC) between Android applications. It discusses writing AIDL interface and implementation files to define service interfaces and how to use AIDL to allow an app's services to be bound by other apps. The key aspects covered are the supported data types in AIDL, how AIDL addresses IPC memory issues, and how to generate AIDL interface implementations to make remote calls between processes using AIDL.
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 services allow long-running tasks to perform work in the background independently of an application's user interface. There are two main types of services: started services which can perform operations indefinitely even if the starting component is destroyed, and bound services which offer a client-server interface between a component and the service. Services must be started with startService() or bound to with bindService() and have lifecycle callback methods like onStartCommand(), onBind(), onCreate(), and onDestroy(). The IntentService class simplifies started service implementation. Bound services can expose interfaces using Binder, Messenger, or AIDL to allow inter-process communication.
The document summarizes key aspects of using JavaScript with the DOM:
1) The DOM represents the document as nodes that can be accessed and manipulated with JavaScript. Common methods are getElementById() and getElementsByTagName() to select nodes, and createElement() to generate new nodes.
2) Events allow JavaScript to react to user actions. Event handlers can be assigned to nodes using onclick attributes or addEventListener(). Events bubble up the DOM tree by default but can be stopped from propagating with stopPropagation().
3) The this keyword refers to the "owner" or context of the executing function, such as the HTML element to which an event handler is assigned. Understanding this is important for manipulating nodes from
This document provides an overview of ExpressJS, a web application framework for Node.js. It discusses using Connect as a middleware framework to build HTTP servers, and how Express builds on Connect by adding functionality like routing, views, and content negotiation. It then covers basic Express app architecture, creating routes, using views with different template engines like Jade, passing data to views, and some advanced topics like cookies, sessions, and authentication.
This document provides an introduction and overview of Node.js, including what Node.js is, its architecture and basics, how to write "Hello World" programs in Node.js and Express, how to use modules, errors, middleware, routers, Mongoose and MongoDB for databases, and the MEAN stack. It also describes a tutorial for building a backend API with Node.js, Express, Mongoose and MongoDB.
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.
The document discusses different types of intents in Android: explicit intents explicitly define which component to call, implicit intents allow Android to search for a component to handle the intent, and data can be sent between intents using extras. It also covers using intents to start activities without a result, and starting sub-activities for result data using startActivityForResult().
This set of slides introduces the basics of the Android development framework and mobile development in general. First, a brief overview on the history of mobile development is introduced. Then, the architecture of the Android platform is discussed, commenting on the role and functionalities of each architectural layer.
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.
This document provides an overview of JVM JIT compilers, specifically focusing on the HotSpot JVM compiler. It discusses the differences between static and dynamic compilation, how just-in-time compilation works in the JVM, profiling and optimizations performed by JIT compilers like inlining and devirtualization, and how to monitor the JIT compiler through options like -XX:+PrintCompilation and -XX:+PrintInlining.
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.
This document is a term paper on Just-In-Time compilers (JIT). It begins with an acknowledgements section thanking the teacher for guidance. It then provides an introduction defining JIT as improving runtime performance of bytecode programs by compiling to machine code during execution. The paper discusses time-space tradeoffs of JIT and how JIT functions by compiling sections of bytecode to native code prior to execution. It also classifies JIT compilers based on invocation, executability, and concurrency. The conclusion restates that the paper provided an overview of JIT compilers.
Java is a programming language that compiles code to bytecode that runs on a Java Virtual Machine (JVM). The JVM is an abstraction layer that executes bytecode similarly across operating systems. It includes components like the bytecode verifier, class loader, execution engine, garbage collector, and security manager. The JVM allows Java to be platform independent and "write once, run anywhere".
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.
The document discusses and compares Dalvik VM and Java VM. It states that Dalvik VM is used in Android and executes optimized .dex files and Dalvik bytecodes, while Java VM executes .class files. It also mentions that Dalvik VM uses register-based architecture while Java VM uses stack-based architecture. The document further discusses advantages of Dalvik VM like minimal memory footprint and how .class files are converted to .dex files. It provides comparisons between key aspects of both VMs.
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.
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.
What is Java Technology (An introduction with comparision of .net coding)Shaharyar khan
A introductory slides for those who want to learn and know some basics of Java.Also for those persons who want to compare coding difference between Java and .net
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.
The document provides an overview of the Java programming language. It discusses that Java was developed in the early 1990s by Sun Microsystems. It then summarizes some of Java's main features, including that it is a simple, object-oriented, robust, distributed, platform independent, secured, architecture-neutral, portable, high-performance, multi-threaded, and dynamic language. It also briefly discusses the Java Virtual Machine, Java Runtime Environment, Java Development Kit, Java bytecode, and the main method.
Copper: A high performance workflow enginedmoebius
COPPER (COmmon Persistable Process Excecution Runtime) is an open-source high performance workflow engine, that persists the workflow instances (process) state into a database. So there is no limit to the runtime of a process. It can run for weeks, month or years. In addition, this strategy leads to crash safety.
A workflow can describe business processes for example, however any kind of use case is supported. The "modelling" language is Java, that has several advantages:
* with COPPER any Java developer is able to design workflows
* all Java developers like to use Java
* many Java libs can be integrated within COPPER
* many Java tools, like IDEs, can be used
* with COPPER your productivity will be increased when using a workflow engine
* using Java solutions will protect your investment
* COPPER is OpenSource under Apache Licence 2.0
Please visit copper-engine.org for details.
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 native application development for Android. It covers using the Native Development Kit (NDK) to write parts of Android apps in native code like C/C++ for performance benefits. The key points are:
- Native code can provide speed improvements for tasks like signal processing but also increases complexity.
- Google's Bionic C library is used instead of glibc for size, speed and licensing reasons and has some differences like lacking C++ exceptions.
- The NDK allows building native code libraries and combining them with Java code via the Java Native Interface (JNI).
- Native code interfaces with Android via JNI and system headers while the build system handles toolchains.
Introduction to Java : Feature to Java, Java Virtual Machine, Differences between C++ and Java,
Part of Java, API Document, Starting a Java Program. Important Classes, Formatting the Output
Synopsis on online shopping by sudeep singhSudeep Singh
This document provides an overview of an online shopping project developed using Java. It discusses the aims of improving customer and vendor services. It maintains customer payment and product details. The key features are high accuracy, flexibility and easy availability. It uses database tables to represent entities and relationships. The project allows customers to shop online and buy items which are then shipped to the submitted address. It has modules for customers and stores.
QTP Interview Questions & Answers discusses various topics related to HP QuickTest Professional (QTP) software. Some key points covered include:
- The different environments and applications that QTP can test, including web, desktop, Java, and more.
- The two types of object repositories in QTP: shared and per-action.
- How QTP uniquely identifies GUI objects using their properties.
- Different recording modes in QTP like normal, low-level, and analog recording.
- Importing and exporting data between QTP and Excel files.
- Handling exceptions and errors using recovery scenarios and On Error statements.
This document provides an overview of Node.js including its history, key features, and common questions. Node.js is a JavaScript runtime environment for building server-side and networking applications. It is based on Google's V8 JavaScript engine and uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, especially for real-time applications that require high throughput and scalability. The Node.js package ecosystem and large developer community help make it a full-stack JavaScript platform for building fast and scalable network applications.
LibOS as a regression test framework for Linux networking #netdev1.1Hajime Tazaki
This document describes using the LibOS framework to build a regression testing system for Linux networking code. LibOS allows running the Linux network stack in a library, enabling deterministic network simulation. Tests can configure virtual networks and run network applications and utilities to identify bugs in networking code by detecting changes in behavior across kernel versions. Example tests check encapsulation protocols like IP-in-IP and detect past kernel bugs. Results are recorded in JUnit format for integration with continuous integration systems.
Java is a high-level programming language and platform developed by James Gosling at Sun Microsystems in 1991. It is designed to be platform independent, meaning that code written in Java can run on any device where a suitable runtime environment exists without modification. The key components that enable platform independence are the Java Virtual Machine (JVM) and the Java Runtime Environment (JRE). The JVM converts Java bytecode into machine code that can be executed by specific CPUs or hardware platforms. The JRE provides the minimum requirements for executing Java applications and includes the JVM, class libraries, and other supporting files.
Five cool ways the JVM can run Apache Spark fasterTim Ellison
The IBM JVM runs Apache Spark fast! This talk explains some of the findings and optimizations from our experience of running Spark workloads.
The talk was originally presented at the SparkEU Summit 2015 in Amsterdam.
Terracotta is Java infrastructure software that allows applications to scale across multiple computers without custom coding. It provides transparent clustering at the JVM level through a shared memory space called Network Attached Memory (NAM). Applications using Terracotta are unaware that it is installed and function the same with or without it. This allows state to be shared across instances.
15. 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.
18. Shared Constant Pool 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(...); } }
Android platform has its own virtual machine dalvik. Every Android application runs in its own process, with its own instance of the Dalvik virtualmachine. Dalvik has been written so that a device can run multiple instances of the VM eciently. The Dalvik VM executes les in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included dx tool. The Dalvik VM relies on the Linux kernelfor underlying functionalities such as threading and low-level memory management. In this presentation we have discussed virtual machines, specially Dalvik virtual machine in detail and their runtime libraries in comparison with JVM's libraries. The report answers questions, such as why Dalvik was needed and how it overcomes the deficiencies of its counterpart Java virtual machine
Virtual Machine (VM) is a software environment that can be an emulator, anoperating system or a complete hardware virtualization, that has an implementationof resources without the actual hardware being present.Thus the main idea of virtual machine is to provide an environment that can execute instructions other than those associated with the host environment regardless of the hardware and software
System VM (also known as hardware virtual machine) and Process VM (also known as application virtual machine) [23]. The categorization is based on their usage and level of correspondence to the associated physical machine. The system VM simulates the complete system hardware stack and supports the execution of complete operating system. On the other hand, Process VM adds up layer over an operating systemwhich is use to simulate the programming environment for the execution of individual process. Virtual Machines are use to share & specify appropriate system resources to the software (could be multiple operating systems or an application); and these softwares are limited to their given resources provided by VM.For many years, in virtual machine architecture, the stack based VMs [23] was the architectural choice due to simplicity of the VM implementation and the size of executables for stack architectures. Registered-based VM [23] can be an attractive alternative to stack-based VM due to the reason that it allows a number of executed VM instructions to be substantially reduced. A study on analysis of dierent VM shows that register-based architecture requires an average of 47% less executed VM instructions than the stack based. On the other hand the register code is 25% largerthan the corresponding stack code but 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. The overall performance of the register-based VM is that it take, on average, a 32.3% less time to execute standard benchmarks.
Dalvik Executable are complied by Dalvik VM, and are zipped into a single .apk (Android Package) le on the device. The .dex les can be created automatically by translating compiled applications written in the Java programming language.The .dex le is divided into dierent constant pool sections. Each constant pool section is of a particular type. The string_ids section identies all strings included in the .dex le. For example, an explicit coded string in the source code or the name of the method or function. At the bottom it contains a series of class denitions as a single .dex le may contain multiple classes.
Every Java program (as usual in Java) is compiled to byte code. The Java byte-code is then transformed into Dalvik byte-code with the help of dx tool and stored in .dex le, and that's on what Dalvik performs operations such as verication and optimization.Developers write their own applications in Java and at build time the Java code is converted to a format compatible with Dalvik VM. The Android SDK has a specialized tool called dx tool which converts the .class les of Java to the Dalvik executable les. The dx tool arranges all the Java class les and eliminate all the redundant information that is present in the class les. The initial le loading and parsing procedures that happens again and again are eliminated. Finally, the byte code from the original class les is written into the new form which is executed by the Dalvik VM.In general, a Java .class le contains a number of dierent method signatures used in the code. These signatures are duplicated if referenced in dierent Java classes. In other words, each of these classes references to the methods that takes the same arguments and the same return type. So, each one of these classes will have to include the same method signatures and hence the eorts of parsing the les are duplicated. In addition to this, there is a large number of strings included that labels the internal bits of the class les. On the other hand, when the Java class les are converted to the Dalvik dex les, only a single dex le is created and all of the class les are included in this le. In the dex conversion all of the separate constant pools are collapsed into a single shared constant pool. This way not only is redundant information eliminated but storagespace to store the shared constant pool is also conserved.
Developers write their own applications in Java and at build time the Java code is converted to a format compatible with Dalvik VM. The Android SDK has a specialized tool called dx tool which converts the .class les of Java to the Dalvik executable les. The dx tool arranges all the Java class les and eliminate all the redundant information that is present in the class les. The initial le loading and parsing procedures that happens again and again are eliminated. Finally, the byte code from the original class les is written into the new form which is executed by the Dalvik VM.In general, a Java .class le contains a number of dierent method signatures used in the code. These signatures are duplicated if referenced in dierent Java classes. In other words, each of these classes references to the methods that takes the same arguments and the same return type. So, each one of these classes will have to include the same method signatures and hence the eorts of parsing the les are duplicated. In addition to this, there is a large number of strings included that labels the internal bits of the class les. On the other hand, when the Java class les are converted to the Dalvik dex les, only a single dex le is created and all of the class les are included in this le. In the dex conversion all of the separate constant pools are collapsed into a single shared constant pool. This way not only is redundant information eliminated but storagespace to store the shared constant pool is also conserved
At the center of every VM is an interpreter. It fetches dalvik instructions and then interprets and executes it on the host processor. This is an extra stage of interpretation between the CPU. This can be slow. Truth is, the Dalvik interpreter is very fast, and much faster than a traditional Java interpreter. But not everything is in interpretation the whole time. The system has already optimized some processes. In typical use, about a third of operations are being done in the interpreter. This is good enough for most apps, but not perfect. A partial solution is the Native Development Kit, which allows apps to call statically-compiled methods. The other solution is JIT, which avoids runtime interpretation and instead translates byte-code to native code at run time.
There are a wide variety of JIT styles. The questions to ask are "when should it compile?" and "what stuff should it compile?". What we need is something that uses a very small amount of memory.It also needs to co-exist with dalvik's container based security model.It must also be quick to deliver a performance boost, rather than require the app to run for a while before performance increases.The transition to compiled code and interpretation should also be very smooth.
There are a wide variety of JIT styles. The questions to ask are "when should it compile?" and "what stuff should it compile?". What we need is something that uses a very small amount of memory.It also needs to co-exist with dalvik's container based security model.It must also be quick to deliver a performance boost, rather than require the app to run for a while before performance increases.The transition to compiled code and interpretation should also be very smooth.
Techniques:Method vs. Trace Granularity....Method granularity JIT is the most common model. it detects the "hot methods" by profiling the app. Once you identify them, the methods probably have some cold code. You end up compiling code that's not used often.Trace granularity JIT starts interpreting to discover the hot chunks, but not entire methods, but rather chunks of instructions. It creates a straight line trace of code and store them in a cache that can chain multiple chunks. You don't have to respect method call boundaries. You only optimize the hottest of the hot code. It has tight integration with the interpreter. It has a rapid return rate on performance boost once hot chunks are detected; only compiling small chunks that are stitched into the application. Weaknesses are that you don't know what's happening outside the hot chunk, so peaks might be brief; more synchronization with the interpreter is required; and it's more difficult to share translations across processes We found that method JIT provides best optimization possibilities, but trace has best return rate on speed and space. So we chose a trace JIT. The trace provides almost immediate speed returns. In the future, we might use both trace and method jit. For example, when charging and plugged in, the method JIT could take control and perform more profiling in the background.
We have a curved translation cache for each process. Sharing only within the sandboxes.Local optimizations include load and store elimination if we can, perform redundant null-checking, and some heuristic scheduling. Loop optimizations include simple loop detection and invartiand code motion, plus variable optimzations