How to use the simgrid.Actor.by_pid function in simgrid

To help you get started, we’ve selected a few simgrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simgrid / simgrid / examples / python / actor-kill / View on Github external
def killer():"Hello!")  # - First start a victim process
    victim_a = Actor.create("victim A", Host.by_name("Fafard"), victim_a_fun)
    victim_b = Actor.create("victim B", Host.by_name("Jupiter"), victim_b_fun)
    this_actor.sleep_for(10)  # - Wait for 10 seconds

    # - Resume it from its suspended state"Resume the victim A")
    this_actor.sleep_for(2)"Kill the victim A")   # - and then kill it
    Actor.by_pid(       # You can retrieve an actor from its PID (and then kill it)


    # that's a no-op, there is no zombies in SimGrid"Kill victim B, even if it's already dead")

    this_actor.sleep_for(1)"Start a new actor, and kill it right away")
    victim_c = Actor.create("victim C", Host.by_name("Jupiter"), victim_a_fun)

    this_actor.sleep_for(1)"Killing everybody but myself")