What is a virtual machine? (Re: Mobile Phones) - diyAudio
Go Back   Home > Forums > General Interest > Everything Else

Everything Else Anything related to audio / video / electronics etc) BUT remember- we have many new forums where your thread may now fit! .... Parts, Equipment & Tools, Construction Tips, Software Tools......

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 28th December 2009, 09:34 PM   #1
diyAudio Member
 
Join Date: Sep 2005
Default What is a virtual machine? (Re: Mobile Phones)

I've been reading on the new mobile phones that are coming out, such as the Android. According to the specs, if a user wants to write their own application, they write it in Java. The Android itself runs on Linux, with the DVM (Dalvik Virtual Machine) running on top of that. [Up to this point, forgive me if I have explained something, or used some term, in error].

I have very limited experience in this kind of application software writing. Can anyone explain to me what a Virtual Machine is, and why a system would use one? I am more used to this kind of programming:

"Write program in C code" --> compile --> "Assembly Code" --> 1's and 0's --> "Run on microcontroller"
  Reply With Quote
Old 28th December 2009, 09:44 PM   #2
diyAudio Moderator Emeritus
 
Iain McNeill's Avatar
 
Join Date: Oct 2007
Location: Santa Cruz, California
It's a virtual machine because it only exists in software (sometimes only vaporware!)
It's what makes a combination of provessors, memory and convertors into a useful machine. On one level, it defines the machine for the hardware and software and creates a set of common interfaces which can then be connected to external nodes/resources like the cell phone radio, the keyboard/display and the speaker/mic.

I'm sure others can expand/correct
  Reply With Quote
Old 28th December 2009, 10:22 PM   #3
Banned
 
Join Date: Jan 2008
Blog Entries: 2
Yeah right. It's a interface definition that an underlying hardware has to support. A Java VM provides certain facilities that a Java program may require. So now there are multiple processor types with various memory organizations and display facilities and input devices in Macs, Nettops and a whole slew of devices other than Windows PCs on all of which a Java program is going to expect to find an identical VM so that a piece of code meeting the definition 'Java' will run with comparable results on any of these items.

Obviously these VMs have to be created but this is in many instances less trouble than might be imagined, as the existing operating systems already provide diverse abstractions for many common computing functions. and consequently a VM running under Windows is probably identical regardless of whether the machine is Intel or AMD.

OTOH a virtual machine in a mobile phone is much more likely to be hand-crafted to match the actual hardware.

Code may be precompiled but is just as likely to interpreted.

w

Last edited by wakibaki; 28th December 2009 at 10:27 PM.
  Reply With Quote
Old 28th December 2009, 10:47 PM   #4
frugal-phile(tm)
diyAudio Moderator
 
planet10's Avatar
 
Join Date: Oct 2001
Location: Victoria, BC, NA, Sol III
Blog Entries: 5
A virtual machine is advantageous in that an ap written for said machine can be deployed on any platform that has software that creates that virtual machine. In this case Java. X11 is another.

dave
__________________
community sites t-linespeakers.org, frugal-horn.com, frugal-phile.com ........ commercial site planet10-HiFi
p10-hifi forum here at diyA
  Reply With Quote
Old 3rd January 2010, 11:13 PM   #5
tvrgeek is offline tvrgeek  United States
diyAudio Member
 
Join Date: Dec 2009
Location: Md
Disadvantageous as it ties up more resources, and you have the possiblity of malware on more than one virtual host. OK, I am old-school. Just write the stinking app in assembly and let it rip. I am sick of waiting forever for my BD player to boot Java. Now my microwave has to boot. Phone? forget it. Oh yea, I forgot, it takes skill to code in assembly. Almost any fool can hack Java. Even me.

What VM's do really well is allow miss-behaving apps and bad code to exist within a single computer and not kill each other. Better to fix the code.
  Reply With Quote
Old 3rd January 2010, 11:54 PM   #6
diyAudio Member
 
Join Date: Jan 2008
It's simply an abstraction layer that allows for the software to be largely independant of the hardware it's running on. This is handy, because it means that Android and all the apps for that platform (for instance) can be ported to x86, ARM or any other architecture that takes your fancy, simply by porting the Java virtual machine - work which has already been done for nearly every architecture.

The other advantage is in memory management - by abstracting the application from the RAM, the possibility of malicious code injection is significantly reduced.

The downside is that it's slower, and adds the overhead of the virtual machine to the hardware requirements.

EDIT: I should note that this process is pretty much entirely transparent to the end user - as far as you're concerned, you write the program in Java, compile it, and run it. It's just that it's compiled to Java Bytecode instead of Assembly, and runs in the VM rather than on the bare metal.
  Reply With Quote
Old 4th January 2010, 12:27 AM   #7
diyAudio Moderator Emeritus
 
Iain McNeill's Avatar
 
Join Date: Oct 2007
Location: Santa Cruz, California
nicely put.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter RF interference from mobile phones joydivision Chip Amps 0 2nd October 2008 06:39 PM
how much DC through phones is okay? cuibono Everything Else 2 20th April 2008 12:22 AM
Favorite cordless phones? joe carrow Everything Else 15 18th April 2007 12:00 AM


New To Site? Need Help?

All times are GMT. The time now is 03:46 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2