ArticleslgStudy

computer science

Dalvik (software)

Dalvik (software) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Dalvik (software) rather than just read about it. In short: Dalvik is a discontinued process virtual machine (VM) in the Android operating system that executes applications written for Android. Dalvik was an integral part of the Android software stack in the (now unsupported) Android versions 4.4 "KitKat" and earlier, which were commonly used on mobile devices such as mobile phones and tablet computers, and more in some devices such as smart TVs and wearables.

Dalvik (software) — main illustration
Dalvik (software) — illustration

Key takeaways

  • Dalvik (software) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Dalvik (software) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Dalvik (software) from memory before moving on to harder problems.

Reference excerpt

Dalvik is a discontinued process virtual machine (VM) in the Android operating system that executes applications written for Android. Dalvik was an integral part of the Android software stack in the (now unsupported) Android versions 4.4 "KitKat" and earlier, which were commonly used on mobile devices such as mobile phones and tablet computers, and more in some devices such as smart TVs and wearables. Dalvik is open-source software, originally written by Dan Bornstein, who named it after the fishing village of Dalvík in Eyjafjörður, Iceland. Programs for Android are commonly written in Java and Kotlin, and compiled to bytecode for the Java Virtual Machine, which is then translated to Dalvik bytecode and stored in .dex (Dalvik EXecutable) and .odex (Optimized Dalvik EXecutable) files; related terms odex and de-odex are associated with respective bytecode conversions. The compact Dalvik Executable format is designed for systems that are constrained in terms of memory and processor speed. The successor of Dalvik is Android Runtime (ART), which uses the same bytecode and .dex files (but not .odex files), with the succession aiming at performance improvements. The new runtime environment was included for the first time in Android 4.4 "KitKat" as a technology preview, and replaced Dalvik entirely in later versions; Android 5.0 "Lollipop" is the first version in which ART is the only included runtime.

History Dalvik, named after a town in Iceland by its creator Dan Bornstein, was designed for embedded devices with very low RAM and CPU to run Java code, and eventually support C++ for "heavy-duty apps" and JavaScript for "light-weight widget-like apps" as first-class languages with Java catering to the rest. Android Native Development Kit which eventually paved way for C++ support has existed since Dalvik's first public release. According to Bornstein, memory-mapping executables and libraries across multiple process and building a faster interpreter with register-based semantics drove much of the early design of the byte-aligned instruction set and the Virtual Machine. Experience working with J2ME on Sidekick at Danger, Bornstein found it was too stripped down and fairly constrained for Android. While improvements such as Isolates as then planned by Sun made process isolation infeasible as it broke Android's intra-Device security model. For Dalvik VM, Bornstein particularly took inspiration from The Case for Register Machines authored by Brian Davis et al. of Trinity College, Dublin. Dalvik was open sourced under Apache License v2 as rest of the Android Open Source Project in 2008.

Architecture

Unlike Java Virtual Machines, which are stack machines, the Dalvik VM uses a register-based architecture that requires fewer, typically more complex, virtual machine instructions. Dalvik programs are written in Java using the Android application programming interface (API), compiled to Java bytecode, and converted to Dalvik instructions as necessary. A tool called dx is used to convert Java .class files into the .dex format. Multiple classes are included in a single .dex file. Duplicate strings and other constants used in multiple class files are included only once in the .dex output to conserve space. Java bytecode is also converted into an alternative instruction set used by the Dalvik VM. An uncompressed .dex file is typically a few percent smaller in size than a compressed Java archive (JAR) derived from the same .class files. The Dalvik executables may be modified again when installed onto a mobile device. In order to gain further optimizations, byte order may be swapped in certain data, simple data structures and function libraries may be linked inline, and empty class objects may be short-circuited, for example. Being optimized for low memory requirements, Dalvik has some specific characteristics that differentiate it from other standard VMs:

The VM was slimmed down to use less space. The constant pool has been modified to use only 32-bit indices to simplify the interpreter. Standard Java bytecode executes 8-bit stack instructions. Local variables must be copied to or from the operand stack by separate instructions. Dalvik instead uses its own 16-bit instruction set that works directly on local variables. The local variable is commonly picked by a 4-bit "virtual register" field. This lowers Dalvik's instruction count and raises its interpreter speed. The design of Dalvik permits a device to run multiple instances of the VM efficiently. Android 2.2 "Froyo" brought trace-based just-in-time (JIT) compilation into Dalvik, optimizing the execution of applications by continually profiling applications each time they run and dynamically compiling frequently executed short segments of their bytecode into native machine code. While Dalvik interprets the rest of application's bytecode, native execution of those short bytecode segments, called "traces", provides significant performance improvements. The potential trace heads are identified in the front-end of the compiler at the parsing stage and after the bytecode conversion. A translation cache is maintained during the runtime. Multiple traces can be chained to reduce synchronisation between the compiler and the interpreter. The trace is optimized by converting it into the Single Static Assignment form, enabling optimizations like dead store elimination, variable folding, and inlining getters and setters.

Performance

… excerpt ends here. Continue reading the full article.

Illustrations

Dalvik (software): A Dalvik-powered phone
A Dalvik-powered phone

Worked examples

Example 1 — a first encounter with Dalvik (software)

Start with the simplest possible case. Write down what Dalvik (software) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Dalvik (software) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Dalvik (software) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Dalvik (software)

In research
Dalvik (software) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Dalvik (software) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Dalvik (software) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Android (operating system), Bytecodes, Discontinued Java virtual machines, so understanding it makes those chapters shorter.
In everyday life
Look for Dalvik (software) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Dalvik (software)” →

How to study Dalvik (software) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Dalvik (software) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Dalvik (software) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Dalvik (software) in simple terms?

Dalvik is a discontinued process virtual machine (VM) in the Android operating system that executes applications written for Android. Dalvik was an integral part of the Android software stack in the (now unsupported) Android versions 4.4 "KitKat" and earlier, which were commonly used on mobile devi…

Why does Dalvik (software) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Dalvik (software)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Dalvik (software).

Tags

  • Android (operating system)
  • Bytecodes
  • Discontinued Java virtual machines
  • Register-based virtual machines

Keep exploring