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

Macros

#define SLEEP(duration)
 

Functions

 XBT_LOG_NEW_DEFAULT_CATEGORY (msg_process_suspend,"Messages specific for this msg example")
 
static int lazy_guy (int argc, char *argv[])
 The Lazy guy only wants to sleep, but can be awaken by the dream_master. More...
 
static int dream_master (int argc, char *argv[])
 The Dream master: More...
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

#define SLEEP (   duration)
Value:
if (MSG_process_sleep(duration) != MSG_OK) \
xbt_die("What's going on??? I failed to sleep!");
#define xbt_die(...)
Kill the program with an error message.
Definition: sysdep.h:44
msg_error_t MSG_process_sleep(double nb_sec)
Sleep for the specified number of seconds.
Definition: msg_gos.cpp:125
Everything is right.
Definition: msg.h:165

Function Documentation

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

The Lazy guy only wants to sleep, but can be awaken by the dream_master.

  • Start by suspending itself
  • Then repetitively go to sleep, but got awaken
static int dream_master ( int  argc,
char *  argv[] 
)
static

The Dream master:

Repeat two times:

  • Suspend the lazy_guy while he's asleep
  • Wait for 10 seconds
  • Then wake up the lazy_guy again
int main ( int  argc,
char *  argv[] 
)
  • Load the platform description
  • Create and deploy the dream_master
  • Run the simulation