2 * JNI interface to Cloud interface in Simgrid
4 * Copyright 2006,2007,2010,2012 The SimGrid Team.
7 * This program is free software; you can redistribute
8 * it and/or modify it under the terms of the license
9 * (GNU LGPL) which comes with this package.
11 package org.simgrid.msg;
13 import org.simgrid.msg.Host;
14 import org.simgrid.msg.Process;
18 * This attribute represents a bind between a java task object and
19 * a native task. Even if this attribute is public you must never
20 * access to it. It is set automatically during the build of the object.
22 private long bind = 0;
24 private int coreAmount;
26 * @brief Create a new empty VM.
27 * @bug it is expected that in the future, the coreAmount parameter will be used
28 * to add extra constraints on the execution, but the argument is ignored for now.
30 public VM(Host host, int coreAmount) {
31 this.coreAmount = coreAmount;
34 * Natively implemented method starting the VM.
37 private native void start(Host host, int coreAmount);
40 * @brief Returns a new array containing all existing VMs.
42 public static native VM[] all();
44 /** @brief Returns whether the given VM is currently suspended
46 public native boolean isSuspended();
47 /** @brief Returns whether the given VM is currently running
49 public native boolean isRunning();
50 /** @brief Add the given process into the VM.
51 * Afterward, when the VM is migrated or suspended or whatever, the process will have the corresponding handling, too.
53 public native void bind(Process process);
54 /** @brief Removes the given process from the given VM, and kill it
55 * Will raise a ProcessNotFound exception if the process were not binded to that VM
57 public native void unbind(Process process);
58 /** @brief Immediately change the host on which all processes are running
60 * No migration cost occurs. If you want to simulate this too, you want to use a
61 * Task.send() before or after, depending on whether you want to do cold or hot
64 public native void migrate(Host destination);
65 /** @brief Immediately suspend the execution of all processes within the given VM
67 * No suspension cost occurs. If you want to simulate this too, you want to
68 * use a \ref File.write() before or after, depending on the exact semantic
69 * of VM suspend to you.
71 public native void suspend();
72 /** @brief Immediately resumes the execution of all processes within the given VM
74 * No resume cost occurs. If you want to simulate this too, you want to
75 * use a \ref File.read() before or after, depending on the exact semantic
76 * of VM resume to you.
78 public native void resume();