examples/msg/energy-consumption/energy-consumption
examples/msg/energy-onoff/energy-onoff
examples/msg/energy-pstate/energy-pstate
-examples/msg/energy-ptask/energy-ptask
examples/msg/energy-vm/energy-vm
examples/msg/io-file/io-file
examples/msg/io-file-unlink/io-file-unlink
examples/msg/platform-failures/platform-failures
examples/msg/plugin-hostload/plugin-hostload
examples/msg/process-create/process-create
-examples/msg/process-daemon/process-daemon
examples/msg/process-kill/process-kill
examples/msg/process-join/process-join
-examples/msg/process-migration/process-migration
examples/msg/process-startkilltime/process-startkilltime
-examples/msg/process-suspend/process-suspend
examples/msg/app-masterworker/app-masterworker
examples/msg/mc/bugged1
examples/msg/mc/bugged1_liveness
examples/s4u/basic/s4u-basic_function
examples/s4u/dht-chord/s4u-dht-chord
examples/s4u/energy-link/s4u-energy-link
+examples/s4u/energy-ptask/s4u-energy-ptask
examples/s4u/io/s4u-io
examples/s4u/mutex/s4u-mutex
examples/s4u/plugin-hostload/s4u-plugin-hostload
teshsuite/msg/app-bittorrent/bittorrent
teshsuite/msg/cloud-sharing/cloud-sharing
teshsuite/msg/concurrent_rw/concurrent_rw
+teshsuite/msg/energy-ptask/energy-ptask
teshsuite/msg/get_sender/get_sender
teshsuite/msg/host_on_off/host_on_off
teshsuite/msg/host_on_off_processes/host_on_off_processes
teshsuite/msg/listen_async/listen_async
teshsuite/msg/pid/pid
teshsuite/msg/process/process
+teshsuite/msg/process-daemon/process-daemon
+teshsuite/msg/process-migration/process-migration
+teshsuite/msg/process-suspend/process-suspend
teshsuite/msg/process-yield/process-yield
teshsuite/msg/storage_client_server/storage_client_server
teshsuite/msg/task_destroy_cancel/task_destroy_cancel
dht-pastry energy-consumption energy-onoff energy-pstate energy-vm platform-failures
io-file io-remote io-storage task-priority
plugin-hostload
- process-create process-daemon process-join process-migration process-suspend
+ process-create process-join
platform-properties process-startkilltime synchro-semaphore trace-categories
trace-route-user-variables trace-link-user-variables trace-masterworker trace-platform
trace-process-migration trace-host-user-variables)
foreach(x app-chainsend app-masterworker app-pingpong app-token-ring
async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-simple
cloud-two-tasks dht-pastry dht-kademlia platform-failures io-file io-remote io-storage task-priority
- process-create process-daemon process-join process-migration process-startkilltime process-suspend
- platform-properties synchro-semaphore)
+ process-create process-join process-startkilltime
+ platform-properties synchro-semaphore)
ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/${x} ${x}.tesh)
endforeach()
Most processes are started from the deployment XML file, but they
can also be used with the @ref MSG_process_create() function.
- - <b>Suspend and Resume processes</b>.
- @ref examples/msg/process-suspend/process-suspend.c \n
- Processes can be suspended and resumed during their executions
- thanks to the @ref MSG_process_suspend and @ref MSG_process_resume functions.
-
-
- - <b>Migrating processes</b>.
- @ref examples/msg/process-migration/process-migration.c \n
- Processes can move or be moved from a host to another with the @ref MSG_process_migrate function.
-
- <b>Controling the process life cycle from the XML</b>.
@ref examples/msg/process-startkilltime/process-startkilltime.c \n
You can specify a start time and a kill time in the deployment
@example examples/msg/async-waitany/async-waitany.c
@example examples/msg/process-create/process-create.c
-@example examples/msg/process-suspend/process-suspend.c
-@example examples/msg/process-migration/process-migration.c
@example examples/msg/process-startkilltime/process-startkilltime.c
@example examples/msg/trace-platform/trace-platform.c
#! ./tesh
-p Testing the suspend/resume feature of MSG
+p Testing the suspend/resume feature of S4U
! output sort 19
$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-suspend ${srcdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
# C examples
foreach(x actions-comm actions-storage cloud-sharing get_sender host_on_off host_on_off_recv host_on_off_processes
- process-kill process-yield
+ process-daemon process-kill process-migration process-suspend process-yield
energy-ptask
trace_integration)
add_executable (${x} ${x}/${x}.c)
foreach(x get_sender host_on_off host_on_off_processes host_on_off_recv
task_destroy_cancel task_listen_from task_progress
- process-kill process-yield
+ process-daemon process-kill process-migration process-suspend process-yield
energy-ptask
trace_integration)
ADD_TESH_FACTORIES(tesh-msg-${x} "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh)
p Testing the process daemonization feature of MSG
-$ $SG_TEST_EXENV ${bindir:=.}/process-daemon ${srcdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/process-daemon ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:worker@Boivin) Let's do some work (for 10 sec on Boivin).
> [ 0.000000] (2:daemon@Tremblay) Hello from the infinite loop
> [ 3.000000] (2:daemon@Tremblay) Hello from the infinite loop
static msg_process_t controlled_process = NULL;
/* The Emigrant process will be moved from host to host. */
-static int emigrant(int argc, char *argv[])
+static int emigrant(int argc, char* argv[])
{
XBT_INFO("I'll look for a new job on another machine ('Boivin') where the grass is greener.");
- MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Boivin")); /* - First, move to another host by myself */
+ MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Boivin")); /* - First, move to another host by myself */
XBT_INFO("Yeah, found something to do");
- msg_task_t task = MSG_task_create("job", 98095000, 0, NULL); /* - Execute some work there */
+ msg_task_t task = MSG_task_create("job", 98095000, 0, NULL); /* - Execute some work there */
MSG_task_execute(task);
MSG_task_destroy(task);
MSG_process_sleep(2);
}
/* The policeman check for emigrants and move them back to 'Jacquelin' */
-static int policeman(int argc, char *argv[])
+static int policeman(int argc, char* argv[])
{
- XBT_INFO("Wait at the checkpoint."); /* - block on the mutex+condition */
+ XBT_INFO("Wait at the checkpoint."); /* - block on the mutex+condition */
MSG_barrier_wait(barrier);
MSG_process_migrate(controlled_process, MSG_host_by_name("Jacquelin")); /* - Move an emigrant to Jacquelin */
XBT_INFO("I moved the emigrant");
return 0;
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
MSG_init(&argc, argv);
xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
- MSG_create_environment(argv[1]); /* - Load the platform description */
+ MSG_create_environment(argv[1]); /* - Load the platform description */
/* - Create and deploy the emigrant and policeman processes */
MSG_process_create("emigrant", emigrant, NULL, MSG_get_host_by_name("Jacquelin"));
MSG_process_create("policeman", policeman, NULL, MSG_get_host_by_name("Boivin"));
p Testing the migration feature of MSG
! output sort 19
-$ $SG_TEST_EXENV ${bindir:=.}/process-migration ${srcdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/process-migration ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:emigrant@Jacquelin) I'll look for a new job on another machine ('Boivin') where the grass is greener.
> [ 0.000000] (1:emigrant@Boivin) Yeah, found something to do
> [ 0.000000] (2:policeman@Boivin) Wait at the checkpoint.
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_process_suspend, "Messages specific for this msg example");
/* The Lazy guy only wants to sleep, but can be awaken by the dream_master process. */
-static int lazy_guy(int argc, char *argv[])
+static int lazy_guy(int argc, char* argv[])
{
XBT_INFO("Nobody's watching me ? Let's go to sleep.");
- MSG_process_suspend(MSG_process_self()); /* - Start by suspending itself */
+ MSG_process_suspend(MSG_process_self()); /* - Start by suspending itself */
XBT_INFO("Uuuh ? Did somebody call me ?");
- XBT_INFO("Going to sleep..."); /* - Then repetitively go to sleep, but got awaken */
+ XBT_INFO("Going to sleep..."); /* - Then repetitively go to sleep, but got awaken */
MSG_process_sleep(10.0);
XBT_INFO("Mmm... waking up.");
}
/* The Dream master: */
-static int dream_master(int argc, char *argv[])
+static int dream_master(int argc, char* argv[])
{
XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */
msg_process_t lazy = MSG_process_create("Lazy", lazy_guy, NULL, MSG_host_self());
XBT_INFO("Let's wait a little bit...");
- MSG_process_sleep(10.0); /* - Wait for 10 seconds */
+ MSG_process_sleep(10.0); /* - Wait for 10 seconds */
XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
- MSG_process_resume(lazy); /* - Then wake up the lazy_guy */
+ MSG_process_resume(lazy); /* - Then wake up the lazy_guy */
- MSG_process_sleep(5.0); /* Repeat two times: */
+ MSG_process_sleep(5.0); /* Repeat two times: */
XBT_INFO("Suspend the lazy guy while he's sleeping...");
- MSG_process_suspend(lazy); /* - Suspend the lazy_guy while he's asleep */
+ MSG_process_suspend(lazy); /* - Suspend the lazy_guy while he's asleep */
XBT_INFO("Let him finish his siesta.");
- MSG_process_sleep(10.0); /* - Wait for 10 seconds */
+ MSG_process_sleep(10.0); /* - Wait for 10 seconds */
XBT_INFO("Wake up, lazy guy!");
- MSG_process_resume(lazy); /* - Then wake up the lazy_guy again */
+ MSG_process_resume(lazy); /* - Then wake up the lazy_guy again */
MSG_process_sleep(5.0);
XBT_INFO("Suspend again the lazy guy while he's sleeping...");
return 0;
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
MSG_init(&argc, argv);
xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
- MSG_create_environment(argv[1]); /* - Load the platform description */
+ MSG_create_environment(argv[1]); /* - Load the platform description */
MSG_function_register("dream_master", dream_master); /* - Create and deploy the dream_master */
xbt_dynar_t hosts = MSG_hosts_as_dynar();
MSG_process_create("dream_master", dream_master, NULL, xbt_dynar_getfirst_as(hosts, msg_host_t));
p Testing the suspend/resume feature of MSG
! output sort 19
-$ $SG_TEST_EXENV ${bindir:=.}/process-suspend ${srcdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/process-suspend ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:dream_master@Boivin) Let's create a lazy guy.
> [ 0.000000] (2:Lazy@Boivin) Nobody's watching me ? Let's go to sleep.
> [ 0.000000] (1:dream_master@Boivin) Let's wait a little bit...