SimGrid  3.15
Versatile Simulation of Distributed Systems

Detailed Description

Interface created to mimic IaaS clouds.

With it, you can create virtual machines to put your processes into, and interact directly with the VMs to manage groups of processes.

This interface is highly experimental at this point. Testing is welcomed, but do not expect too much of it right now. Even the interfaces may be changed in future releases of SimGrid (although things are expected to stabilize nicely before SimGrid v3.8). There is no guaranty on the rest of SimGrid, and there is less than that on this part.

Functions

int MSG_vm_is_created (msg_vm_t vm)
 Opaque type describing a Virtual Machine. More...
 
int MSG_vm_is_running (msg_vm_t vm)
 Returns whether the given VM is currently running. More...
 
int MSG_vm_is_migrating (msg_vm_t vm)
 Returns whether the given VM is currently migrating. More...
 
int MSG_vm_is_suspended (msg_vm_t vm)
 Returns whether the given VM is currently suspended, not running. More...
 
msg_vm_t MSG_vm_create (msg_host_t pm, const char *name, int ramsize, int mig_netspeed, int dp_intensity)
 Create a new VM with specified parameters. More...
 
msg_vm_t MSG_vm_create_core (msg_host_t pm, const char *name)
 Create a new VM object. More...
 
void MSG_vm_destroy (msg_vm_t vm)
 Destroy a VM. More...
 
void MSG_vm_start (msg_vm_t vm)
 Start a vm (i.e., boot the guest operating system)If the VM cannot be started (because of memory overprovisionning), an exception is generated. More...
 
void MSG_vm_shutdown (msg_vm_t vm)
 Immediately kills all processes within the given VM. More...
 
void MSG_vm_migrate (msg_vm_t vm, msg_host_t dst_pm)
 Migrate the VM to the given host. More...
 
void MSG_vm_suspend (msg_vm_t vm)
 Immediately suspend the execution of all processes within the given VM. More...
 
void MSG_vm_resume (msg_vm_t vm)
 Resume the execution of the VM. More...
 
msg_host_t MSG_vm_get_pm (msg_vm_t vm)
 Get the physical host of a given VM. More...
 
void MSG_vm_set_bound (msg_vm_t vm, double bound)
 Set a CPU bound for a given VM. More...
 

Function Documentation

◆ MSG_vm_is_created()

int MSG_vm_is_created ( msg_vm_t  vm)

Opaque type describing a Virtual Machine.

Returns whether the given VM has just created, not running.

All this is highly experimental and the interface will probably change in the future. Please don't depend on this yet (although testing is welcomed if you feel so). Usual lack of guaranty of any kind applies here, and is even increased.

◆ MSG_vm_is_running()

int MSG_vm_is_running ( msg_vm_t  vm)

Returns whether the given VM is currently running.

◆ MSG_vm_is_migrating()

int MSG_vm_is_migrating ( msg_vm_t  vm)

Returns whether the given VM is currently migrating.

◆ MSG_vm_is_suspended()

int MSG_vm_is_suspended ( msg_vm_t  vm)

Returns whether the given VM is currently suspended, not running.

◆ MSG_vm_create()

msg_vm_t MSG_vm_create ( msg_host_t  pm,
const char *  name,
int  ramsize,
int  mig_netspeed,
int  dp_intensity 
)

Create a new VM with specified parameters.

  • Parameters
    pmPhysical machine that will host the VM
    nameMust be unique
    ramsize[TODO]
    mig_netspeedAmount of Mbyte/s allocated to the migration (cannot be larger than net_cap). Use 0 if unsure.
    dp_intensityDirty page percentage according to migNetSpeed, [0-100]. Use 0 if unsure.

◆ MSG_vm_create_core()

msg_vm_t MSG_vm_create_core ( msg_host_t  pm,
const char *  name 
)

Create a new VM object.

The VM is not yet started. The resource of the VM is allocated upon MSG_vm_start().

  • A VM is treated as a host. The name of the VM must be unique among all hosts.

◆ MSG_vm_destroy()

void MSG_vm_destroy ( msg_vm_t  vm)

Destroy a VM.

Destroy the VM object from the simulation.

◆ MSG_vm_start()

void MSG_vm_start ( msg_vm_t  vm)

Start a vm (i.e., boot the guest operating system)If the VM cannot be started (because of memory overprovisionning), an exception is generated.

◆ MSG_vm_shutdown()

void MSG_vm_shutdown ( msg_vm_t  vm)

Immediately kills all processes within the given VM.

Any memory that they allocated will be leaked, unless you used MSG_process_on_exit().

No extra delay occurs. If you want to simulate this too, you want to use a MSG_process_sleep().

◆ MSG_vm_migrate()

void MSG_vm_migrate ( msg_vm_t  vm,
msg_host_t  dst_pm 
)

Migrate the VM to the given host.

◆ MSG_vm_suspend()

void MSG_vm_suspend ( msg_vm_t  vm)

Immediately suspend the execution of all processes within the given VM.

This function stops the execution of the VM. All the processes on this VM will pause. The state of the VM is preserved. We can later resume it again.

No suspension cost occurs.

◆ MSG_vm_resume()

void MSG_vm_resume ( msg_vm_t  vm)

Resume the execution of the VM.

All processes on the VM run again.

No resume cost occurs.

◆ MSG_vm_get_pm()

msg_host_t MSG_vm_get_pm ( msg_vm_t  vm)

Get the physical host of a given VM.

◆ MSG_vm_set_bound()

void MSG_vm_set_bound ( msg_vm_t  vm,
double  bound 
)

Set a CPU bound for a given VM.

  1. Note that in some cases MSG_task_set_bound() may not intuitively work for VMs.

For example, On PM0, there are Task1 and VM0. On VM0, there is Task2. Now we bound 75% to Task1@PM0 and bound 25% to Task2@VM0. Then, Task1@PM0 gets 50%. Task2@VM0 gets 25%. This is NOT 75% for Task1@PM0 and 25% for Task2@VM0, respectively.

This is because a VM has the dummy CPU action in the PM layer. Putting a task on the VM does not affect the bound of the dummy CPU action. The bound of the dummy CPU action is unlimited.

There are some solutions for this problem. One option is to update the bound of the dummy CPU action automatically. It should be the sum of all tasks on the VM. But, this solution might be costly, because we have to scan all tasks on the VM in share_resource() or we have to trap both the start and end of task execution.

The current solution is to use MSG_vm_set_bound(), which allows us to directly set the bound of the dummy CPU action.

  1. Note that bound == 0 means no bound (i.e., unlimited). But, if a host has multiple CPU cores, the CPU share of a computation task (or a VM) never exceeds the capacity of a CPU core.