Selecting and starting a virtual machine (ZD)
Please read the Terms of Use for Materials on ZennoLab
Description
This note describes how to correctly select and run virtual machines (VMs) when working with ZennoDroid.
How does ZennoDroid work with virtual machines (VM)?
In case of random selection (when no name or index is specified in the Select action) ZennoDroid always selects a random VM that is not occupied at the moment.
If you want to manually select a machine, then you must control yourself so that different threads do not select the same machine at the same time.
Let's take an example:
there is a VM named
Memu_1
and two projects,Project1
andProject2
, that work with this VM.Project1
starts earlier and takes over VMMemu_1
to itself. ThenProject2
is launched and "sees" that the VM is occupied.
It will wait 60 seconds and, if the VM is not free, it will fail. If, during these 60 seconds,Project1
gets free the VM, then the second project will “pick up” the VM and work with it.The same will happen if the project is strictly specified to work with a specific VM and the project is launched in several threads - the thread that started earlier will take over the VM, and the second thread will show an error.
1. Selecting a virtual machine
First of all, you need to select the VM with which the current thread will work. You can do this using the Select action in the Virtual Machine action.
How to choose the right VM
It is not necessary (but possible) to select a VM in ProjectMaker, since the program works with the VM, which is set by default (it can be changed in the settings).
The simplest option would be to randomly select a VM.
To do this, leave the “Full name or index” field empty in the Select action settings. And in the fields for the name and index, you need to specify the variables where the corresponding data will be saved.
With this approach, ZennoDroid searches among all available virtual machines that are not currently occupied.
A virtual machine that is selected by default in the settings is always considered occupied and ZennoDroid, if randomly selected, will skip it.
If, while working in ProjectMaker, you switch (via an action) to another VM, then this selected VM will be considered the default machine and now it will be ignored.
2. Running a virtual machine
After the VM has been selected, it needs to be started. To do this, use the Start\Restart action from the Virtual machine action article.