#########################################
## touched files to track the dependencies of java examples
examples/java/app/bittorrent/java_app_bittorrent_compiled
+examples/java/app/centralizedmutex/java_app_centralizedmutex_compiled
examples/java/app/masterworker/java_app_masterworker_compiled
examples/java/async/java_async_compiled
examples/java/dht/chord/java_dht_chord_compiled
examples/java/process/kill/java_process_kill_compiled
examples/java/process/migration/java_process_migration_compiled
examples/java/process/suspend/java_process_suspend_compiled
-examples/java/mutualExclusion/java_mutualExclusion_compiled
examples/java/pingPong/java_pingPong_compiled
examples/java/priority/java_priority_compiled
examples/java/process/startkilltime/java_process_startkilltime_compiled
${srcdir}/MessageTask.java ${srcdir}/Peer.java ${srcdir}/Tracker.java
${srcdir}/TrackerTask.java)
+set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex)
+set(app_centralizedmutex_sources ${srcdir}/Main.java ${srcdir}/Coordinator.java ${srcdir}/GrantTask.java
+ ${srcdir}/Node.java ${srcdir}/ReleaseTask.java ${srcdir}/RequestTask.java)
+
set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker)
set(app_masterworker_sources ${srcdir}/Main.java ${srcdir}/Master.java ${srcdir}/Worker.java)
set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
set(process_suspend_sources ${srcdir}/Main.java ${srcdir}/DreamMaster.java ${srcdir}/LazyGuy.java)
-foreach (example app_bittorrent app_masterworker cloud_migration cloud_masterworker dht_chord dht_kademlia
- energy_consumption energy_vm io_file io_storage process_kill process_migration process_startkilltime
- process_suspend)
+foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker
+ dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
+ process_startkilltime process_suspend)
string (REPLACE "_" "/" example_dir ${example})
if(enable_java)
add_custom_command(
set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/README
${CMAKE_CURRENT_SOURCE_DIR}/cloud/migration PARENT_SCOPE)
set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/app/centralizedmutex/centralizedmutex.xml
${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml PARENT_SCOPE)
if(enable_java)
- foreach (example app_bittorrent app_masterworker cloud_migration cloud_masterworker dht_chord dht_kademlia
- energy_consumption energy_vm io_file io_storage process_kill process_migration process_startkilltime
- process_suspend)
+ foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker
+ dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
+ process_startkilltime process_suspend)
string (REPLACE "_" "/" example_dir ${example})
ADD_TESH(java-${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
endforeach()
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-package mutualExclusion;
+package app.centralizedmutex;
import java.util.LinkedList;
import org.simgrid.msg.Msg;
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-package mutualExclusion;
+package app.centralizedmutex;
public class GrantTask extends org.simgrid.msg.Task {}
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-package mutualExclusion;
+package app.centralizedmutex;
import org.simgrid.msg.Msg;
import org.simgrid.msg.NativeException;
-public class MutexCentral {
+public class Main {
public static void main(String[] args) throws NativeException {
Msg.init(args);
- if(args.length < 2) {
- Msg.info("Usage: MutexCentral platform_file deployment_file");
- Msg.info("Fallback to default values");
- Msg.createEnvironment("../platform/small_platform.xml");
- Msg.deployApplication("mutex_centralized_deployment.xml");
- } else {
- /* construct the platform and deploy the application */
- Msg.createEnvironment(args[0]);
- Msg.deployApplication(args[1]);
- }
+ String platf = args.length > 1 ? args[0] : "../platforms/small_platform.xml";
+ String deploy = args.length > 1 ? args[1] : "./centralizedmutex.xml";
+
+ /* construct the platform and deploy the application */
+ Msg.createEnvironment(platf);
+ Msg.deployApplication(deploy);
/* execute the simulation. */
Msg.run();
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-package mutualExclusion;
+package app.centralizedmutex;
import org.simgrid.msg.Msg;
import org.simgrid.msg.Host;
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-package mutualExclusion;
+package app.centralizedmutex;
public class ReleaseTask extends org.simgrid.msg.Task {}
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-package mutualExclusion;
+package app.centralizedmutex;
import org.simgrid.msg.Task;
public class RequestTask extends Task {
--- /dev/null
+#! tesh
+
+! output sort 19
+
+$ java -classpath ${classpath:=.} app/centralizedmutex/Main ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/app/centralizedmutex/centralizedmutex.xml
+> [0.000000] [jmsg/INFO] Using regular java threads.
+> [Jupiter:app.centralizedmutex.Node:(2) 0.000000] [jmsg/INFO] Send a request to the coordinator
+> [Fafard:app.centralizedmutex.Node:(3) 0.000000] [jmsg/INFO] Send a request to the coordinator
+> [Tremblay:app.centralizedmutex.Coordinator:(1) 0.019014] [jmsg/INFO] Got a request from app.centralizedmutex.Node. Queue empty: grant it
+> [Jupiter:app.centralizedmutex.Node:(2) 0.019014] [jmsg/INFO] Wait for a grant from the coordinator
+> [Fafard:app.centralizedmutex.Node:(3) 0.063737] [jmsg/INFO] Wait for a grant from the coordinator
+> [Tremblay:app.centralizedmutex.Coordinator:(1) 0.063737] [jmsg/INFO] Got a request from app.centralizedmutex.Node. Queue empty: grant it
+> [Tremblay:app.centralizedmutex.Coordinator:(1) 0.134167] [jmsg/INFO] we should shutdown the simulation now
+> [0.134167] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
<platform version="4">
- <process host="Tremblay" function="mutualExclusion.Coordinator">
+ <process host="Tremblay" function="app.centralizedmutex.Coordinator">
<argument value="2"/> <!-- Amount of CS to serve -->
</process>
- <process host="Jupiter" function="mutualExclusion.Node">
+ <process host="Jupiter" function="app.centralizedmutex.Node">
<argument value="2"/> <!-- initial sleep time -->
<argument value="5"/> <!-- CS time -->
</process>
- <process host="Fafard" function="mutualExclusion.Node">
+ <process host="Fafard" function="app.centralizedmutex.Node">
<argument value="2"/> <!-- initial sleep time -->
<argument value="5"/> <!-- CS time -->
</process>
+++ /dev/null
-set(example java_mutualExclusion)
-set(sources ${CMAKE_CURRENT_SOURCE_DIR}/Coordinator.java ${CMAKE_CURRENT_SOURCE_DIR}/GrantTask.java
- ${CMAKE_CURRENT_SOURCE_DIR}/MutexCentral.java ${CMAKE_CURRENT_SOURCE_DIR}/Node.java
- ${CMAKE_CURRENT_SOURCE_DIR}/ReleaseTask.java ${CMAKE_CURRENT_SOURCE_DIR}/RequestTask.java)
-
-if(enable_java)
- add_custom_command(
- COMMENT "Building ${example}..."
- OUTPUT ${example}_compiled
- DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
- COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
- COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
- COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
- )
- add_custom_target(${example} ALL DEPENDS ${example}_compiled)
- ADD_TESH(java-mutualExclusion --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/mutualExclusion/mutualexclusion.tesh)
-endif()
-
-set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/mutualexclusion.tesh PARENT_SCOPE)
-set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/mutex_centralized_deployment.xml PARENT_SCOPE)
-set(examples_src ${examples_src} ${sources} PARENT_SCOPE)
+++ /dev/null
-#! tesh
-
-! output sort 19
-
-$ java -classpath ${classpath:=.} mutualExclusion/MutexCentral ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/mutualExclusion/mutex_centralized_deployment.xml
-> [0.000000] [jmsg/INFO] Using regular java threads.
-> [Jupiter:mutualExclusion.Node:(2) 0.000000] [jmsg/INFO] Send a request to the coordinator
-> [Fafard:mutualExclusion.Node:(3) 0.000000] [jmsg/INFO] Send a request to the coordinator
-> [Tremblay:mutualExclusion.Coordinator:(1) 0.019014] [jmsg/INFO] Got a request from mutualExclusion.Node. Queue empty: grant it
-> [Jupiter:mutualExclusion.Node:(2) 0.019014] [jmsg/INFO] Wait for a grant from the coordinator
-> [Fafard:mutualExclusion.Node:(3) 0.063737] [jmsg/INFO] Wait for a grant from the coordinator
-> [Tremblay:mutualExclusion.Coordinator:(1) 0.063737] [jmsg/INFO] Got a request from mutualExclusion.Node. Queue empty: grant it
-> [Tremblay:mutualExclusion.Coordinator:(1) 0.134167] [jmsg/INFO] we should shutdown the simulation now
-> [0.134167] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
set(CMAKEFILES_TXT
examples/java/CMakeLists.txt
examples/java/async/CMakeLists.txt
- examples/java/mutualExclusion/CMakeLists.txt
examples/java/pingPong/CMakeLists.txt
examples/java/priority/CMakeLists.txt
examples/java/tracing/CMakeLists.txt