Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
small comments improvements around a complex code
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 15 Aug 2019 13:37:24 +0000 (15:37 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 15 Aug 2019 13:37:41 +0000 (15:37 +0200)
src/kernel/activity/ActivityImpl.hpp
src/mc/checker/SimcallInspector.hpp
src/mc/mc_state.cpp

index d8d5914..f9532eb 100644 (file)
@@ -32,8 +32,11 @@ public:
   virtual void suspend();
   virtual void resume();
   virtual void cancel();
-  virtual void post()   = 0; // What to do when a simcall terminates
-  virtual void finish() = 0;
+
+  virtual void post() = 0; // Called by the main loop when the activity is marked as terminated or failed by its model.
+                           // Setups the status, clean things up, and call finish()
+  virtual void finish() = 0; // Unlock all simcalls blocked on that activity, either because it was marked as done by
+                             // the model or because it terminated without waiting for the model
 
   virtual void register_simcall(smx_simcall_t simcall);
   void clean_action();
index d1327f3..0771540 100644 (file)
@@ -20,6 +20,14 @@ public:
    */
   virtual bool is_enabled() { return true; }
 
+  /** Execute the simcall, from the kernel POV.
+   *
+   * Most of the time, this action is in charge of doing what the perf models would have done if not in MC mode.
+   * For example, if it's a random(), choose the value to explore next. If it's a waitany, choose the terminated
+   * communication to consider now.
+   */
+  virtual void fire();
+
   /** Some simcalls may only be observable under some circomstances.
    * Most simcalls are not visible from the MC because they don't have an inspector at all. */
   virtual bool is_visible() { return true; }
index acb6bc2..8825430 100644 (file)
@@ -118,12 +118,12 @@ static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State*
       mc_model_checker->process().read(temp_act, remote_act);
       simgrid::kernel::activity::CommImpl* act = temp_act.get_buffer();
       if (act->src_actor_.get() && act->dst_actor_.get())
-        state->transition_.argument_ = 0;
+        state->transition_.argument_ = 0; // OK
       else if (act->src_actor_.get() == nullptr && act->type_ == simgrid::kernel::activity::CommImpl::Type::READY &&
                act->detached())
-        state->transition_.argument_ = 0;
+        state->transition_.argument_ = 0; // OK
       else
-        state->transition_.argument_ = -1;
+        state->transition_.argument_ = -1; // timeout
       procstate->set_done();
       req = &actor->simcall;
       break;