1 /* Copyright (c) 2006-2014, 2016. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
9 /** This example demonstrates the use of the Task.dsend() method.
11 * This way, the sender can be detached from the communication: it is not blocked as with Task.send()
12 * and has nothing to do at the end as with Task.isend() where it must do a Comm.wait().
15 import org.simgrid.msg.Msg;
16 import org.simgrid.msg.Host;
17 import org.simgrid.msg.NativeException;
18 import org.simgrid.msg.HostNotFoundException;
22 /* This is just to ensure that nobody creates an instance of this singleton */
23 throw new IllegalAccessError("Utility class");
26 public static void main(String[] args) throws NativeException, HostNotFoundException {
29 String platform = "../platforms/small_platform.xml";
30 if (args.length >= 1) {
31 platform = args[0]; // Override the default value if passed on the command line
34 /* construct the platform and deploy the application */
35 Msg.createEnvironment(platform);
36 Host[] hosts = Host.all();
37 new Sender(hosts[0],"Sender").start();
38 for (int i=1; i < hosts.length; i++){
39 new Receiver(hosts[i], "Receiver").start();
41 /* execute the simulation. */