Why is there a separate VM instance (Dalvik / ART) for each Android application?

As the title says,
Why is there a separate VM instance (Dalvik / ART) for each Android application? (need for it)

and what would happen if Android chose a model where one virtual machine runs all applications?

+6
source share
2 answers

There are many reasons why running multiple applications in the same process does not work; here are two:

Security zones.

Two applications that do not trust each other cannot view each other's memory, even if they use their own code or reflection.

Fault tolerance.

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

+5
source

Why is there a separate virtual machine instance (Dalvik / ART) for each application? (need for it)

This is a design decision, and, in my opinion, is made so that it is simple. Each process runs in its own vm . All resources are allocated for this process, and vm , internally, should not coordinate access to resources, for example. FileDescriptor s, I/O , etc. I have never heard of multiprocess vm (vm, which allows you to run multiple processes in it), but I found an article that you could give you insight into.

+1
source

Source: https://habr.com/ru/post/989885/


All Articles