Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Improve comments on examples
[simgrid.git] / examples / msg / mc / centralized_mutex.c
index 3d6ed63..73b27eb 100644 (file)
@@ -1,14 +1,12 @@
-/* Centralized Mutual Exclusion Algorithm 
- *
- * This constitutes the answer to the exercice 2 of the practical 
- * lab on implementing mutual exclusion algorithms with SimGrid.
- * 
- * YOU SHOULD TRY IMPLEMENTING IT YOURSELF BEFORE READING THE SOLUTION.
- */
+/***************** Centralized Mutual Exclusion Algorithm *********************/
+/* This example implements a centralized mutual exclusion algorithm.          */
+/* There is no bug on it, it is just provided to test the state space         */
+/* reduction of DPOR.                                                         */
+/******************************************************************************/
 
 #include "msg/msg.h"
 
-#define AMOUNT_OF_CLIENTS 5
+#define AMOUNT_OF_CLIENTS 4
 #define CS_PER_PROCESS 2
 XBT_LOG_NEW_DEFAULT_CATEGORY(centralized, "my log messages");
 
@@ -47,7 +45,7 @@ int coordinator(int argc, char*argv[]) {
        todo--;
       }
     }
-    //MSG_task_destoy(task);
+    MSG_task_destroy(task);
   }
   INFO0("Received all releases, quit now");
   return 0;
@@ -65,7 +63,7 @@ int client(int argc, char *argv[]) {
     // wait the answer
     m_task_t grant = NULL;
     MSG_task_receive(&grant,my_mailbox);
-    //MSG_task_destoy(grant);
+    MSG_task_destroy(grant);
     INFO0("got the answer. Sleep a bit and release it");
     MSG_process_sleep(1);
     MSG_task_send(MSG_task_create("release",0,1000,NULL),"coordinator");    
@@ -80,7 +78,7 @@ int main(int argc, char*argv[]) {
   MSG_create_environment("../msg_platform.xml");
   MSG_function_register("coordinator", coordinator);
   MSG_function_register("client", client);
-  MSG_launch_application("deploy.xml");
+  MSG_launch_application("deploy_mutex.xml");
   MSG_main();
   return 0;
 }