SimGrid  3.13
Versatile Simulation of Distributed Systems
app-masterworker.c File Reference
#include "simgrid/msg.h"

Functions

 XBT_LOG_NEW_DEFAULT_CATEGORY (msg_app_masterworker,"Messages specific for this msg example")
 
static int master (int argc, char *argv[])
 Master expects 4 arguments given in the XML deployment file: More...
 
static int worker (int argc, char *argv[])
 Worker expects a single argument given in the XML deployment file: More...
 
int main (int argc, char *argv[])
 

Function Documentation

XBT_LOG_NEW_DEFAULT_CATEGORY ( msg_app_masterworker  ,
"Messages specific for this msg example"   
)
static int master ( int  argc,
char *  argv[] 
)
static

Master expects 4 arguments given in the XML deployment file:

  • Number of tasks
  • Task compute cost
  • Task communication size
  • Number of workers

For each task to be executed:

  • Select a worker in a round-robin way
  • Create a task
  • Send the task to the worker
  • Eventually tell all the workers to stop by sending a "finalize" task
static int worker ( int  argc,
char *  argv[] 
)
static

Worker expects a single argument given in the XML deployment file:

  • unique id of the worker

The worker wait in an infinite loop for tasks sent by the master

  • Exit if 'finalize' is received
  • Otherwise, process the task
int main ( int  argc,
char *  argv[] 
)
  • Load the platform description
  • Register the function to be executed by the processes
  • Deploy the application
  • Run the simulation