Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
[simgrid.git] / src / simix / smx_global.cpp
1 /* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "mc/mc.h"
7 #include "simgrid/s4u/Engine.hpp"
8 #include "simgrid/s4u/Host.hpp"
9 #include "src/smpi/include/smpi_actor.hpp"
10
11 #include "simgrid/sg_config.hpp"
12 #include "src/kernel/activity/ExecImpl.hpp"
13 #include "src/kernel/activity/IoImpl.hpp"
14 #include "src/kernel/activity/MailboxImpl.hpp"
15 #include "src/kernel/activity/SleepImpl.hpp"
16 #include "src/kernel/activity/SynchroRaw.hpp"
17 #include "src/mc/mc_record.hpp"
18 #include "src/mc/mc_replay.hpp"
19 #include "src/simix/smx_private.hpp"
20 #include "src/surf/xml/platf.hpp"
21
22 #include "simgrid/kernel/resource/Model.hpp"
23
24 #if SIMGRID_HAVE_MC
25 #include "src/mc/remote/AppSide.hpp"
26 #endif
27
28 #include <memory>
29
30 XBT_LOG_NEW_CATEGORY(simix, "All SIMIX categories");
31 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix, "Logging specific to SIMIX (kernel)");
32
33 std::unique_ptr<simgrid::simix::Global> simix_global;
34
35 void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr) = nullptr;
36
37 namespace simgrid {
38 namespace simix {
39 config::Flag<bool> cfg_verbose_exit{"debug/verbose-exit",
40                                     "Display the actor status at exit",
41                                     true};
42 } // namespace simix
43 } // namespace simgrid
44
45 XBT_ATTRIB_NORETURN static void inthandler(int)
46 {
47   if (simgrid::simix::cfg_verbose_exit) {
48     XBT_INFO("CTRL-C pressed. The current status will be displayed before exit (disable that behavior with option "
49              "'debug/verbose-exit').");
50     simix_global->display_all_actor_status();
51   }
52   else {
53     XBT_INFO("CTRL-C pressed, exiting. Hiding the current process status since 'debug/verbose-exit' is set to false.");
54   }
55   exit(1);
56 }
57
58 #ifndef _WIN32
59 static void segvhandler(int signum, siginfo_t* siginfo, void* /*context*/)
60 {
61   if ((siginfo->si_signo == SIGSEGV && siginfo->si_code == SEGV_ACCERR) || siginfo->si_signo == SIGBUS) {
62     fprintf(stderr,
63             "Access violation or Bus error detected.\n"
64             "This probably comes from a programming error in your code, or from a stack\n"
65             "overflow. If you are certain of your code, try increasing the stack size\n"
66             "   --cfg=contexts/stack-size=XXX (current size is %u KiB).\n"
67             "\n"
68             "If it does not help, this may have one of the following causes:\n"
69             "a bug in SimGrid, a bug in the OS or a bug in a third-party libraries.\n"
70             "Failing hardware can sometimes generate such errors too.\n"
71             "\n"
72             "If you think you've found a bug in SimGrid, please report it along with a\n"
73             "Minimal Working Example (MWE) reproducing your problem and a full backtrace\n"
74             "of the fault captured with gdb or valgrind.\n",
75             smx_context_stack_size / 1024);
76   } else  if (siginfo->si_signo == SIGSEGV) {
77     fprintf(stderr, "Segmentation fault.\n");
78 #if HAVE_SMPI
79     if (smpi_enabled() && smpi_cfg_privatization() == SmpiPrivStrategies::NONE) {
80 #if HAVE_PRIVATIZATION
81       fprintf(stderr, "Try to enable SMPI variable privatization with --cfg=smpi/privatization:yes.\n");
82 #else
83       fprintf(stderr, "Sadly, your system does not support --cfg=smpi/privatization:yes (yet).\n");
84 #endif /* HAVE_PRIVATIZATION */
85     }
86 #endif /* HAVE_SMPI */
87   }
88   std::raise(signum);
89 }
90
91 /**
92  * Install signal handler for SIGSEGV.  Check that nobody has already installed
93  * its own handler.  For example, the Java VM does this.
94  */
95 static void install_segvhandler()
96 {
97   stack_t old_stack;
98
99   if (simgrid::kernel::context::Context::install_sigsegv_stack(&old_stack, true) == -1) {
100     XBT_WARN("Failed to register alternate signal stack: %s", strerror(errno));
101     return;
102   }
103   if (not(old_stack.ss_flags & SS_DISABLE)) {
104     XBT_DEBUG("An alternate stack was already installed (sp=%p, size=%zu, flags=%x). Restore it.", old_stack.ss_sp,
105               old_stack.ss_size, (unsigned)old_stack.ss_flags);
106     sigaltstack(&old_stack, nullptr);
107   }
108
109   struct sigaction action;
110   struct sigaction old_action;
111   action.sa_sigaction = &segvhandler;
112   action.sa_flags = SA_ONSTACK | SA_RESETHAND | SA_SIGINFO;
113   sigemptyset(&action.sa_mask);
114
115   /* Linux tend to raise only SIGSEGV where other systems also raise SIGBUS on severe error */
116   for (int sig : {SIGSEGV, SIGBUS}) {
117     if (sigaction(sig, &action, &old_action) == -1) {
118       XBT_WARN("Failed to register signal handler for signal %d: %s", sig, strerror(errno));
119       continue;
120     }
121     if ((old_action.sa_flags & SA_SIGINFO) || old_action.sa_handler != SIG_DFL) {
122       XBT_DEBUG("A signal handler was already installed for signal %d (%p). Restore it.", sig,
123                 (old_action.sa_flags & SA_SIGINFO) ? (void*)old_action.sa_sigaction : (void*)old_action.sa_handler);
124       sigaction(sig, &old_action, nullptr);
125     }
126   }
127 }
128
129 #endif /* _WIN32 */
130
131 /********************************* SIMIX **************************************/
132 namespace simgrid {
133 namespace simix {
134
135 Timer* Timer::set(double date, xbt::Task<void()>&& callback)
136 {
137   auto* timer    = new Timer(date, std::move(callback));
138   timer->handle_ = simix_timers().emplace(std::make_pair(date, timer));
139   return timer;
140 }
141
142 /** @brief cancels a timer that was added earlier */
143 void Timer::remove()
144 {
145   simix_timers().erase(handle_);
146   delete this;
147 }
148
149 /** Execute all the tasks that are queued, e.g. `.then()` callbacks of futures. */
150 bool Global::execute_tasks()
151 {
152   xbt_assert(tasksTemp.empty());
153
154   if (tasks.empty())
155     return false;
156
157   do {
158     // We don't want the callbacks to modify the vector we are iterating over:
159     tasks.swap(tasksTemp);
160
161     // Execute all the queued tasks:
162     for (auto& task : tasksTemp)
163       task();
164
165     tasksTemp.clear();
166   } while (not tasks.empty());
167
168   return true;
169 }
170
171 void Global::empty_trash()
172 {
173   while (not actors_to_destroy.empty()) {
174     kernel::actor::ActorImpl* actor = &actors_to_destroy.front();
175     actors_to_destroy.pop_front();
176     XBT_DEBUG("Getting rid of %s (refcount: %d)", actor->get_cname(), actor->get_refcount());
177     intrusive_ptr_release(actor);
178   }
179 #if SIMGRID_HAVE_MC
180   xbt_dynar_reset(dead_actors_vector);
181 #endif
182 }
183 /**
184  * @brief Executes the actors in actors_to_run.
185  *
186  * The actors in actors_to_run are run (in parallel if possible). On exit, actors_to_run is empty, and actors_that_ran
187  * contains the list of actors that just ran.  The two lists are swapped so, be careful when using them before and after
188  * a call to this function.
189  */
190 void Global::run_all_actors()
191 {
192   simix_global->context_factory->run_all();
193
194   actors_to_run.swap(actors_that_ran);
195   actors_to_run.clear();
196 }
197
198 /** Wake up all actors waiting for a Surf action to finish */
199 void Global::wake_all_waiting_actors() const
200 {
201   for (auto const& model : all_existing_models) {
202     kernel::resource::Action* action;
203
204     XBT_DEBUG("Handling the failed actions (if any)");
205     while ((action = model->extract_failed_action())) {
206       XBT_DEBUG("   Handling Action %p", action);
207       if (action->get_activity() != nullptr)
208         kernel::activity::ActivityImplPtr(action->get_activity())->post();
209     }
210     XBT_DEBUG("Handling the terminated actions (if any)");
211     while ((action = model->extract_done_action())) {
212       XBT_DEBUG("   Handling Action %p", action);
213       if (action->get_activity() == nullptr)
214         XBT_DEBUG("probably vcpu's action %p, skip", action);
215       else
216         kernel::activity::ActivityImplPtr(action->get_activity())->post();
217     }
218   }
219 }
220
221 void Global::display_all_actor_status() const
222 {
223   XBT_INFO("%zu actors are still running, waiting for something.", process_list.size());
224   /*  List the actors and their state */
225   XBT_INFO("Legend of the following listing: \"Actor <pid> (<name>@<host>): <status>\"");
226   for (auto const& kv : process_list) {
227     kernel::actor::ActorImpl* actor = kv.second;
228
229     if (actor->waiting_synchro_) {
230       const char* synchro_description = "unknown";
231
232       if (boost::dynamic_pointer_cast<kernel::activity::ExecImpl>(actor->waiting_synchro_) != nullptr)
233         synchro_description = "execution";
234
235       if (boost::dynamic_pointer_cast<kernel::activity::CommImpl>(actor->waiting_synchro_) != nullptr)
236         synchro_description = "communication";
237
238       if (boost::dynamic_pointer_cast<kernel::activity::SleepImpl>(actor->waiting_synchro_) != nullptr)
239         synchro_description = "sleeping";
240
241       if (boost::dynamic_pointer_cast<kernel::activity::RawImpl>(actor->waiting_synchro_) != nullptr)
242         synchro_description = "synchronization";
243
244       if (boost::dynamic_pointer_cast<kernel::activity::IoImpl>(actor->waiting_synchro_) != nullptr)
245         synchro_description = "I/O";
246
247       XBT_INFO("Actor %ld (%s@%s): waiting for %s activity %#zx (%s) in state %d to finish", actor->get_pid(),
248                actor->get_cname(), actor->get_host()->get_cname(), synchro_description,
249                (xbt_log_no_loc ? (size_t)0xDEADBEEF : (size_t)actor->waiting_synchro_.get()),
250                actor->waiting_synchro_->get_cname(), (int)actor->waiting_synchro_->state_);
251     } else {
252       XBT_INFO("Actor %ld (%s@%s)", actor->get_pid(), actor->get_cname(), actor->get_host()->get_cname());
253     }
254   }
255 }
256
257 config::Flag<double> cfg_breakpoint{"debug/breakpoint",
258                                     "When non-negative, raise a SIGTRAP after given (simulated) time",
259                                     -1.0};
260 } // namespace simix
261 } // namespace simgrid
262
263 static simgrid::kernel::actor::ActorCode maestro_code;
264 void SIMIX_set_maestro(void (*code)(void*), void* data)
265 {
266 #ifdef _WIN32
267   XBT_INFO("WARNING, SIMIX_set_maestro is believed to not work on windows. Please help us investigating this issue if you need that feature");
268 #endif
269   maestro_code = std::bind(code, data);
270 }
271
272 /**
273  * @ingroup SIMIX_API
274  * @brief Initialize SIMIX internal data.
275  */
276 void SIMIX_global_init(int *argc, char **argv)
277 {
278 #if SIMGRID_HAVE_MC
279   // The communication initialization is done ASAP.
280   // We need to communicate  initialization of the different layers to the model-checker.
281   simgrid::mc::AppSide::initialize();
282 #endif
283
284   if (simix_global == nullptr) {
285     surf_init(argc, argv); /* Initialize SURF structures */
286
287     simix_global           = std::make_unique<simgrid::simix::Global>();
288     simix_global->maestro_ = nullptr;
289     SIMIX_context_mod_init();
290
291     // Either create a new context with maestro or create
292     // a context object with the current context maestro):
293     simgrid::kernel::actor::create_maestro(maestro_code);
294
295     /* Prepare to display some more info when dying on Ctrl-C pressing */
296     std::signal(SIGINT, inthandler);
297
298 #ifndef _WIN32
299     install_segvhandler();
300 #endif
301     /* register a function to be called by SURF after the environment creation */
302     sg_platf_init();
303     simgrid::s4u::Engine::on_platform_created.connect(surf_presolve);
304   }
305
306   if (simgrid::config::get_value<bool>("debug/clean-atexit"))
307     atexit(SIMIX_clean);
308 }
309
310 /**
311  * @ingroup SIMIX_API
312  * @brief Clean the SIMIX simulation
313  *
314  * This functions remove the memory used by SIMIX
315  */
316 void SIMIX_clean()
317 {
318   static bool smx_cleaned = false;
319   if (smx_cleaned)
320     return; // to avoid double cleaning by java and C
321
322   smx_cleaned = true;
323   XBT_DEBUG("SIMIX_clean called. Simulation's over.");
324   if (not simix_global->actors_to_run.empty() && SIMIX_get_clock() <= 0.0) {
325     XBT_CRITICAL("   ");
326     XBT_CRITICAL("The time is still 0, and you still have processes ready to run.");
327     XBT_CRITICAL("It seems that you forgot to run the simulation that you setup.");
328     xbt_die("Bailing out to avoid that stop-before-start madness. Please fix your code.");
329   }
330
331 #if HAVE_SMPI
332   if (not simix_global->process_list.empty()) {
333     if(smpi_process()->initialized()){
334       xbt_die("Process exited without calling MPI_Finalize - Killing simulation");
335     }else{
336       XBT_WARN("Process called exit when leaving - Skipping cleanups");
337       return;
338     }
339   }
340 #endif
341
342   /* Kill all processes (but maestro) */
343   simix_global->maestro_->kill_all();
344   simix_global->run_all_actors();
345   simix_global->empty_trash();
346
347   /* Exit the SIMIX network module */
348   SIMIX_mailbox_exit();
349
350   while (not simgrid::simix::simix_timers().empty()) {
351     delete simgrid::simix::simix_timers().top().second;
352     simgrid::simix::simix_timers().pop();
353   }
354   /* Free the remaining data structures */
355   simix_global->actors_to_run.clear();
356   simix_global->actors_that_ran.clear();
357   simix_global->actors_to_destroy.clear();
358   simix_global->process_list.clear();
359
360 #if SIMGRID_HAVE_MC
361   xbt_dynar_free(&simix_global->actors_vector);
362   xbt_dynar_free(&simix_global->dead_actors_vector);
363 #endif
364
365   /* Let's free maestro now */
366   delete simix_global->maestro_;
367   simix_global->maestro_ = nullptr;
368
369   /* Finish context module and SURF */
370   SIMIX_context_mod_exit();
371
372   surf_exit();
373
374   simix_global = nullptr;
375 }
376
377 /**
378  * @ingroup SIMIX_API
379  * @brief A clock (in second).
380  *
381  * @return Return the clock.
382  */
383 double SIMIX_get_clock()
384 {
385   if(MC_is_active() || MC_record_replay_is_active()){
386     return MC_process_clock_get(SIMIX_process_self());
387   }else{
388     return surf_get_clock();
389   }
390 }
391
392 /** Handle any pending timer. Returns if something was actually run. */
393 static bool SIMIX_execute_timers()
394 {
395   bool result = false;
396   while (not simgrid::simix::simix_timers().empty() &&
397          SIMIX_get_clock() >= simgrid::simix::simix_timers().top().first) {
398     result = true;
399     // FIXME: make the timers being real callbacks (i.e. provide dispatchers that read and expand the args)
400     smx_timer_t timer = simgrid::simix::simix_timers().top().second;
401     simgrid::simix::simix_timers().pop();
402     timer->callback();
403     delete timer;
404   }
405   return result;
406 }
407
408 /**
409  * @ingroup SIMIX_API
410  * @brief Run the main simulation loop.
411  */
412 void SIMIX_run()
413 {
414   if (MC_record_replay_is_active()) {
415     simgrid::mc::replay(MC_record_path());
416     return;
417   }
418
419   double time = 0;
420
421   do {
422     XBT_DEBUG("New Schedule Round; size(queue)=%zu", simix_global->actors_to_run.size());
423
424     if (simgrid::simix::cfg_breakpoint >= 0.0 && surf_get_clock() >= simgrid::simix::cfg_breakpoint) {
425       XBT_DEBUG("Breakpoint reached (%g)", simgrid::simix::cfg_breakpoint.get());
426       simgrid::simix::cfg_breakpoint = -1.0;
427 #ifdef SIGTRAP
428       std::raise(SIGTRAP);
429 #else
430       std::raise(SIGABRT);
431 #endif
432     }
433
434     simix_global->execute_tasks();
435
436     while (not simix_global->actors_to_run.empty()) {
437       XBT_DEBUG("New Sub-Schedule Round; size(queue)=%zu", simix_global->actors_to_run.size());
438
439       /* Run all processes that are ready to run, possibly in parallel */
440       simix_global->run_all_actors();
441
442       /* answer sequentially and in a fixed arbitrary order all the simcalls that were issued during that sub-round */
443
444       /* WARNING, the order *must* be fixed or you'll jeopardize the simulation reproducibility (see RR-7653) */
445
446       /* Here, the order is ok because:
447        *
448        *   Short proof: only maestro adds stuff to the actors_to_run array, so the execution order of user contexts do
449        *   not impact its order.
450        *
451        *   Long proof: actors remain sorted through an arbitrary (implicit, complex but fixed) order in all cases.
452        *
453        *   - if there is no kill during the simulation, actors remain sorted according by their PID.
454        *     Rationale: This can be proved inductively.
455        *        Assume that actors_to_run is sorted at a beginning of one round (it is at round 0: the deployment file
456        *        is parsed linearly).
457        *        Let's show that it is still so at the end of this round.
458        *        - if an actor is added when being created, that's from maestro. It can be either at startup
459        *          time (and then in PID order), or in response to a process_create simcall. Since simcalls are handled
460        *          in arbitrary order (inductive hypothesis), we are fine.
461        *        - If an actor is added because it's getting killed, its subsequent actions shouldn't matter
462        *        - If an actor gets added to actors_to_run because one of their blocking action constituting the meat
463        *          of a simcall terminates, we're still good. Proof:
464        *          - You are added from ActorImpl::simcall_answer() only. When this function is called depends on the
465        *            resource kind (network, cpu, disk, whatever), but the same arguments hold. Let's take communications
466        *            as an example.
467        *          - For communications, this function is called from SIMIX_comm_finish().
468        *            This function itself don't mess with the order since simcalls are handled in FIFO order.
469        *            The function is called:
470        *            - before the comm starts (invalid parameters, or resource already dead or whatever).
471        *              The order then trivial holds since maestro didn't interrupt its handling of the simcall yet
472        *            - because the communication failed or were canceled after startup. In this case, it's called from
473        *              the function we are in, by the chunk:
474        *                       set = model->states.failed_action_set;
475        *                       while ((synchro = extract(set)))
476        *                          SIMIX_simcall_post((smx_synchro_t) synchro->data);
477        *              This order is also fixed because it depends of the order in which the surf actions were
478        *              added to the system, and only maestro can add stuff this way, through simcalls.
479        *              We thus use the inductive hypothesis once again to conclude that the order in which synchros are
480        *              popped out of the set does not depend on the user code's execution order.
481        *            - because the communication terminated. In this case, synchros are served in the order given by
482        *                       set = model->states.done_action_set;
483        *                       while ((synchro = extract(set)))
484        *                          SIMIX_simcall_post((smx_synchro_t) synchro->data);
485        *              and the argument is very similar to the previous one.
486        *            So, in any case, the orders of calls to CommImpl::finish() do not depend on the order in which user
487        *            actors are executed.
488        *          So, in any cases, the orders of actors within actors_to_run do not depend on the order in which
489        *          user actors were executed previously.
490        *     So, if there is no killing in the simulation, the simulation reproducibility is not jeopardized.
491        *   - If there is some actor killings, the order is changed by this decision that comes from user-land
492        *     But this decision may not have been motivated by a situation that were different because the simulation is
493        *     not reproducible.
494        *     So, even the order change induced by the actor killing is perfectly reproducible.
495        *
496        *   So science works, bitches [http://xkcd.com/54/].
497        *
498        *   We could sort the actors_that_ran array completely so that we can describe the order in which simcalls are
499        *   handled (like "according to the PID of issuer"), but it's not mandatory (order is fixed already even if
500        *   unfriendly).
501        *   That would thus be a pure waste of time.
502        */
503
504       for (auto const& actor : simix_global->actors_that_ran) {
505         if (actor->simcall_.call_ != simgrid::simix::Simcall::NONE) {
506           actor->simcall_handle(0);
507         }
508       }
509
510       simix_global->execute_tasks();
511       do {
512         simix_global->wake_all_waiting_actors();
513       } while (simix_global->execute_tasks());
514
515       /* If only daemon processes remain, cancel their actions, mark them to die and reschedule them */
516       if (simix_global->process_list.size() == simix_global->daemons.size())
517         for (auto const& dmon : simix_global->daemons) {
518           XBT_DEBUG("Kill %s", dmon->get_cname());
519           simix_global->maestro_->kill(dmon);
520         }
521     }
522
523     time = simgrid::simix::Timer::next();
524     if (time > -1.0 || not simix_global->process_list.empty()) {
525       XBT_DEBUG("Calling surf_solve");
526       time = surf_solve(time);
527       XBT_DEBUG("Moving time ahead : %g", time);
528     }
529
530     /* Notify all the hosts that have failed */
531     /* FIXME: iterate through the list of failed host and mark each of them */
532     /* as failed. On each host, signal all the running processes with host_fail */
533
534     // Execute timers and tasks until there isn't anything to be done:
535     bool again = false;
536     do {
537       again = SIMIX_execute_timers();
538       if (simix_global->execute_tasks())
539         again = true;
540       simix_global->wake_all_waiting_actors();
541     } while (again);
542
543     /* Clean actors to destroy */
544     simix_global->empty_trash();
545
546     XBT_DEBUG("### time %f, #processes %zu, #to_run %zu", time, simix_global->process_list.size(),
547               simix_global->actors_to_run.size());
548
549     if (time < 0. && simix_global->actors_to_run.empty() && not simix_global->process_list.empty()) {
550       if (simix_global->process_list.size() <= simix_global->daemons.size()) {
551         XBT_CRITICAL("Oops! Daemon actors cannot do any blocking activity (communications, synchronization, etc) "
552                      "once the simulation is over. Please fix your on_exit() functions.");
553       } else {
554         XBT_CRITICAL("Oops! Deadlock or code not perfectly clean.");
555       }
556       simix_global->display_all_actor_status();
557       simgrid::s4u::Engine::on_deadlock();
558       for (auto const& kv : simix_global->process_list) {
559         XBT_DEBUG("Kill %s", kv.second->get_cname());
560         simix_global->maestro_->kill(kv.second);
561       }
562     }
563   } while (time > -1.0 || not simix_global->actors_to_run.empty());
564
565   if (not simix_global->process_list.empty())
566     THROW_IMPOSSIBLE;
567
568   simgrid::s4u::Engine::on_simulation_end();
569 }
570
571 double SIMIX_timer_next() // XBT_ATTRIB_DEPRECATED_v329
572 {
573   return simgrid::simix::Timer::next();
574 }
575
576 smx_timer_t SIMIX_timer_set(double date, void (*callback)(void*), void* arg) // XBT_ATTRIB_DEPRECATED_v329
577 {
578   return simgrid::simix::Timer::set(date, std::bind(callback, arg));
579 }
580
581 /** @brief cancels a timer that was added earlier */
582 void SIMIX_timer_remove(smx_timer_t timer) // XBT_ATTRIB_DEPRECATED_v329
583 {
584   timer->remove();
585 }
586
587 /** @brief Returns the date at which the timer will trigger (or 0 if nullptr timer) */
588 double SIMIX_timer_get_date(smx_timer_t timer) // XBT_ATTRIB_DEPRECATED_v329
589 {
590   return timer ? timer->get_date() : 0;
591 }
592
593 void SIMIX_display_process_status() // XBT_ATTRIB_DEPRECATED_v329
594 {
595   simix_global->display_all_actor_status();
596 }
597
598 int SIMIX_is_maestro()
599 {
600   if (simix_global == nullptr) // SimDag
601     return true;
602   const simgrid::kernel::actor::ActorImpl* self = SIMIX_process_self();
603   return self == nullptr || self == simix_global->maestro_;
604 }