1. Team SimPy
  2. simpy
  3. simpy
  4. Issues
Issue #4 resolved

Feature Request: Preemption Visibility

Forrest Iandola
created an issue

Preemption Visibility. It would be great if we could have more hooks into preemption and reactivate-from-preemption events. Here are a couple ways that this information could be exposed:

  • Each Process could "know" the history of its arrival time, preemption times, reactivate-from-preemption times, and finish time.
  • Each Resource could maintain a list of arrival/preemption/finish times for tasks that execute on the Resource.
  • There could be a way to create events that signal when a preemption or reactivation happens, and the user can catalog the data that he/she wants.

  • Ideally, when looking at the preemption history for Process X, it should be clear which higher-priority Process Y is responsible for each preemption of Process X.

As discussed in this simpy-users thread (http://sourceforge.net/mailarchive/forum.php?thread_name=2114134.xqJWZDnfty%40bebop&forum_name=simpy-users), it's possible to obtain this data through SimulationTrace. However, using SimulationTrace just prints the trace without any data structures or anything. Alternatively, as Ontje Lünsdorf explained in the same thread, it's possible to use a function decorator to track preemptions, but I'm not sure if the decorator can also determine the identity of the higher priority Process Y that preempts a given Process X.

I'm not currently sure how to implement this.

Comments (6)

  1. Stefan Scherfke

    Please have a look at the preemptive resource (see pull request #6). The preempted process will receive the time when it started to use the resource and a reference to the preempting process. The when the preemption occured can be retrieved via env.now.

    This informatiion can than be stored in a monitor (which is not yet implemented :-))

  2. Log in to comment