22 October 2008

Efficient use of resources in Android

Now that Android is out, people will start looking into that great (and big) code produced by Google engineers.

One thing they have always claimed is that the Dalvik VM is safe, with each instance running in a separate process, while still efficient with resource sharing among instances.
I didn't know how that could be possibile since processes in Linux (on MMU-ful processors) have got dinstinct address spaces.

But now I've gone back to a presentation I hadn't listened to carefully enough at the time.
http://sites.google.com/site/io/dalvik-vm-internals

Basically, a Dalvik VM process is created at the beginning. Each new instance of the VM is a 'fork' of the original one (that is called, ironically, Zygote).
What I did not know is that the 'fork' action in Unix is highly efficient and makes a copy of the memory pages just when they get modified, which you wouldn't expect for most code.

http://en.wikipedia.org/wiki/Fork(operatingsystem)

No comments:

Post a Comment