Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
end slavery in java world
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 09:26:39 +0000 (11:26 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 09:26:39 +0000 (11:26 +0200)
examples/java/app/masterworker/Master.java
examples/java/app/masterworker/README
examples/java/app/masterworker/Worker.java
examples/java/cloud/masterworker/Master.java
examples/java/process/kill/Killer.java

index a030b69..6c2b872 100644 (file)
@@ -1,4 +1,4 @@
-/* Master of a basic master/slave example in Java */
+/* Master of a basic master/worker example in Java */
 
 /* Copyright (c) 2006-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* Copyright (c) 2006-2014. The SimGrid Team.
  * All rights reserved.                                                     */
index 14bc4c4..56d2f29 100644 (file)
@@ -1,7 +1,7 @@
 This is a somehow basic master/workers example.
 
 There is 2 kind of processes:
 This is a somehow basic master/workers example.
 
 There is 2 kind of processes:
- * Master: creates some tasks, and dispatches them to its slaves
+ * Master: creates some tasks, and dispatches them to its workers
  * Worker: get tasks from the master and run them
 
 At the end of the execution:
  * Worker: get tasks from the master and run them
 
 At the end of the execution:
index 9ca9a2d..ff68aac 100644 (file)
@@ -26,7 +26,7 @@ public class Worker extends Process {
     }
 
     int num = Integer.valueOf(args[0]).intValue();
     }
 
     int num = Integer.valueOf(args[0]).intValue();
-    //Msg.info("Receiving on 'slave_"+num+"'");
+    //Msg.info("Receiving on 'worker_"+num+"'");
 
     while(true) {  
       Task task = Task.receive("worker_"+num);
 
     while(true) {  
       Task task = Task.receive("worker_"+num);
index 28f424b..c783dec 100644 (file)
@@ -24,11 +24,11 @@ public class Master extends Process {
   }
 
   public void main(String[] args) throws MsgException {
   }
 
   public void main(String[] args) throws MsgException {
-    int slavesCount = Main.hostNB;
+    int workersCount = Main.hostNB;
     ArrayList<VM> vms = new ArrayList<VM>();
 
     // Create one VM per host and bind a process inside each one. 
     ArrayList<VM> vms = new ArrayList<VM>();
 
     // Create one VM per host and bind a process inside each one. 
-    for (int i = 0; i < slavesCount; i++) {
+    for (int i = 0; i < workersCount; i++) {
       Msg.info("create VM0"+i);  
       VM vm = new VM(hosts[i+1],"VM0"+i);
       vm.start();
       Msg.info("create VM0"+i);  
       VM vm = new VM(hosts[i+1],"VM0"+i);
       vm.start();
@@ -41,7 +41,7 @@ public class Master extends Process {
     Msg.info("Launched " + vms.size() + " VMs");
 
     Msg.info("Send a first batch of work to everyone");
     Msg.info("Launched " + vms.size() + " VMs");
 
     Msg.info("Send a first batch of work to everyone");
-    workBatch(slavesCount);
+    workBatch(workersCount);
 
     Msg.info("Suspend all VMs");
     for (int i = 0; i < vms.size(); i++) {
 
     Msg.info("Suspend all VMs");
     for (int i = 0; i < vms.size(); i++) {
@@ -63,11 +63,11 @@ public class Master extends Process {
 /*    Msg.info("Add one more process per VM.");
     for (int i = 0; i < vms.size(); i++) {
       VM vm = vms.get(i);
 /*    Msg.info("Add one more process per VM.");
     for (int i = 0; i < vms.size(); i++) {
       VM vm = vms.get(i);
-      Slave slave = new Slave(vm,i + vms.size());
-      slave.start();
+      Worker worker = new Worker(vm,i + vms.size());
+      worker.start();
     }
 
     }
 
-    workBatch(slavesCount * 2);
+    workBatch(workersCount * 2);
 */
 
     Msg.info("Migrate everyone to "+hosts[3].getName());
 */
 
     Msg.info("Migrate everyone to "+hosts[3].getName());
@@ -85,8 +85,8 @@ public class Master extends Process {
     Msg.info("Master done.");
   }
 
     Msg.info("Master done.");
   }
 
-  public void workBatch(int slavesCount) throws MsgException {
-    for (int i = 0; i < slavesCount; i++) {
+  public void workBatch(int workersCount) throws MsgException {
+    for (int i = 0; i < workersCount; i++) {
       Task task = new Task("Task0" + i, Main.task_comp_size, Main.task_comm_size);
       Msg.info("Sending to WRK0" + i);
       task.send("MBOX:WRK0" + i);
       Task task = new Task("Task0" + i, Main.task_comp_size, Main.task_comm_size);
       Msg.info("Sending to WRK0" + i);
       task.send("MBOX:WRK0" + i);
index b465908..35c7990 100644 (file)
@@ -1,5 +1,3 @@
-/* Master of a basic master/slave example in Java */
-
 /* Copyright (c) 2006-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* Copyright (c) 2006-2014. The SimGrid Team.
  * All rights reserved.                                                     */