java and android os_presentation

14
JAVA AND ANDROID OS HOW JAVA RUNS ON ANDROID OPERATING SYSTEM, WITHOUT ANDROID HAVING JAVA RUN TIME. PRESENTATION BY : AGBOOLA BENJAMIN AKINTAYO COURSE: IT-600-G4165 OPERATING SYSTEMS PROFESSOR :Vaughn Rogers

Upload: benjamin-agboola

Post on 14-Jan-2017

528 views

Category:

Documents


0 download

TRANSCRIPT

JAVA AND ANDROID OSHOW JAVA RUNS ON ANDROID OPERATING SYSTEM,

WITHOUT ANDROID HAVING JAVA RUN TIME.

PRESENTATION BY : AGBOOLA BENJAMIN AKINTAYO

COURSE: IT-600-G4165 OPERATING SYSTEMS

PROFESSOR :Vaughn Rogers

ANDROID

• BACKGROUND

Android operating system, been the most popular operating system ruling the mobile and embedded device world, it got its stability and acceptability by playing on two popular technologies that are presently inevitable in the IT world which are Linux Kernel and JAVA programming Language.

JAVA

BACKGROUND

• Java been one of the popular programing languages,

• Give’s developers the ability to write one single code which can run on any platform.

• This capability was possible due to the fact that java run time ( which contains Java virtual

machine ) is present on the Platform.

• The presence of this JVM makes the platform irrelevant to the developer, because all platform or

hardware appears same ( Platform Independence).

• This characteristics gave JAVA the nickname “write once , run anywhere” WORA.

• This means a programmer can develop code on a PC and can expect it to run on Java enabled cell

phones, as well as on routers and mainframes equipped with Java Run time, without any

adjustments.

HOW JAVA WORKS AND RUN

• Developers write human readable codes with java.

• The JDK ( java development kit) within the IDE archives the java classes in JAR files ( java archive files).

• Basically JDK converts java source codes into Byte code and eventually binary code which is targeted for a JVM ( Java virtual machine).

HOW JVM WORKS

• JVM- stands for Java Virtual Machine. Every platform has its own version

of JVM. The JVM allows for Java's most important feature- platform

independence. Every Java program is compiled into byte code which can

then be distributed. Then JRE processes this byte code and sends it to the

JVM. JVM then creates the machine code based on the platform and creates

an executable that the machine can understand. This executable is what we

can call the running program. JVM is essential to run Java programs. JVM

comes with JRE and is different for different platforms.

JAVA PLATFORMS

There are multiple platforms, each targeting a different class of devices:

1. Java Card: A technology that allows small Java-based applications (applets) to be run securely on smart cards and similar small-memory devices.

2. Java ME (Micro Edition): For devices with limited storage, display, and power capacities. Used to develop applications for mobile devices, PDAs, TV set-top boxes, Cars.

3. Java SE (Standard Edition): For general-purpose use on desktop PCs, servers and similar devices.

4. Java EE (Enterprise Edition): Useful for multi-tier client–server enterprise applications. Including network and web services, and other large-scale, scalable, reliable, and secure network applications.

HOW JVM WORKS ( Diagram)

Windows OS Linux OS

Hardware Hardware

ETC...

Hardware

Same Operation, Same result, from same code

Java Virtual Machine

JVM operation and transition across several OS

Single Java Byte Code

Machine code

JRE

FLOW OF JAVA CODES TO ITS OPERATION ON SYSTEM

Java compiler converts Java human readable codes to Java Byte code understandable by computer

machines

{JAVA source code}

{JAVA byte code}

{Machine code}

Java Compiler

JVM

Device Machine

Operation Execution

HOW ANDROID RUNS JAVA

Nevertheless, Android OS also runs and executes Java codes without it having JVM (Java Virtual Machine ); it does that by its own Virtual machine known as Dalvik.

Dalvik is made from codes from a project called the Apache Harmony project. Apache Harmony Project is a discontinued standalone project that has 97% completion with JAVA standard edition 6 ,without infringing on SUN JAVA’s intellectual property.

WHAT IS DALVIK

• Dalvik is open source process Virtual machine that runs on Android OS , it’s an interpreter only VM that

executes files in the Dalvik executable format ( .dex). Most android applications are written in Java but

Android does not have Java virtual machine, so Java byte codes are not executed. For execution of java

source codes, Java classes are compiled into a proprietary byte code (.dex) by a tool called “dx” and later

converted into Dalvik instructions to run on Android.

• Dalvik is register-based VM and runs on top of Posix-compliant operating systems, which it relies on for

underlying functionality (such as threading and low level memory management). The underlying Linux kernel

of the Android OS spawns a new Dalvik VM instance for every process. Each process in Android has its own

Dalvik VM instance.

FLOW OF JAVA CODES TO ITS OPERATION ON ANDROID POWERED DEVICES

• Developers write Java codes in high level programming language ( Java).

• Java compiler compiles the source code into a device independent "byte code" rather than

directly to machine code.

• The Dx Tool in android SDK converts the java byte code into Android byte code (.dex

file ) byte code.

• Dalvik virtual machine converts the .dex files to machine code

• The Hardware carrying the Android OS understands the machine code and performs the

operation.

FLOW DIAGRAM

Machine code

Java Compiler

Dex Compiler

Dalvik executable is ran by Dalvik VM

Java Source Code

Java Byte code

Dalvik Byte Code

Dalvik

Device Machine

How Android OS runs Java codes with out JRE ( Java run Time)

COMPARE THE JAVA FLOW BETWEEN JVM AND DALVIK.

THANK YOU