Manish Kumar Sharma
Manish Kumar Sharma

Reputation: 13432

Why is there a separate instance of VM(Dalvik/ART) for every App on Android?

As the title states,
Why is there a separate instance of VM(Dalvik/ART) for every App on Android?(the need for it)

and, what would have happened if the Android OS had chosen a model where a single VM runs all the apps?

Upvotes: 7

Views: 1057

Answers (2)

Jesse Wilson
Jesse Wilson

Reputation: 40593

There are many reasons why running multiple applications in a single process doesn't work; here's two:

Security zones.

Two applications that don't trust one another shouldn't be able to view each other's memory, even if they use native code or reflection.

Failure isolation.

If a process leaks memory and crashes, it harms only itself.

Upvotes: 5

Blackbelt
Blackbelt

Reputation: 157437

Why there is a separate instance of VM(Dalvik/ART) for every App?(the need for it)

It is a design decision, and in my opinion, is made to keep it simple. Every process runs in its own vm. All the resources are allocated to that process, and the vm, internally, has not to coordinate access to resources, e.g. FileDescriptors, I/O etc. I never heard of multiprocess vm (a vm that allows more than one process to run in it), but I found an article that you could give you an insight.

Upvotes: 1

Related Questions