BackgroundExecution is available as:
The ThreadedComposite in this model has delay 2.0, so executing this model produces exactly the same result as if the ThreadedComposite were replaced by a TimedDelay with delay 2.0.
However, in this implementation, the ThreadedComposite takes a full 1.5 seconds to execute (this implemented with a Sleep actor inside). That execution occurs in the background and does not block firings of the other actors, except as necessary to preserve timed DE semantics. Thus, notice that the lower actors react to events at times 0, 0.25, 1, and 1.25 before the ThreadedComposite has completed its execution.
This illustrates that ThreadedComposite can be used to execute actors that take a while to execute. For example, if you have an actor that will block on I/O, wrapping it in a ThreadedComposite may be a good idea. Also, on a multicore machine, the ThreadedComposite can execute on another core, thus exploiting parallelism.
For details, see E.A. Lee, "ThreadedComposite: A Mechanism for Building Concurrent and Parallel Ptolemy II Models," EECS Department, University of California, Berkeley, Technical Report No. UCB/EECS-2008-151, December 7, 2008.