Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pbayer committed Sep 2, 2020
2 parents 5a4e37a + be97de6 commit 50987d2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/src/actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
CurrentModule = DiscreteEvents
```

Even if not considered in classical literature about DES, [Actors](https://en.wikipedia.org/wiki/Actor_model) are natural candidates to represent entities in discrete event systems. They are not bound to typical event sequences, can operate as finite state machines, can assemble into systems and represent hierarchies. They can spawned to and interoperate over threads.
Even if not considered in classical literature about DES, [Actors](https://en.wikipedia.org/wiki/Actor_model) are natural candidates to represent entities in discrete event systems. They are not bound to typical event sequences, can operate as finite state machines, can assemble into systems and represent hierarchies. They can be spawned to and interoperate over threads.

## Reactive programming
## Assumptions about Actors

Actors run as Julia tasks listening to a (message) channel. They block only if they have no message in their channel. Therefore they run in a simple loop, reacting to a message when it arrives according to their current state. They don't share their state with other actors or their environment.
[Actors](https://pbayer.github.io/DiscreteEventsCompanion.jl/dev/actors/#An-Operational-Definition) run as Julia tasks listening to a (message) channel. They block only if they have no message in their channel. Therefore they run in a simple loop, reacting to a message when it arrives according to their current state. They don't share their state with other Actors or their environment.

!!! warning "Don't use `delay!` or `wait!` with actors"
!!! warning "Don't use `delay!` or `wait!` with Actors"

Those are blocking operations and will make an actor non-responsive, just as a process.

In order to integrate into the `DiscreteEvents` framework, Actors register their channels to the `clock.channels` vector. Then the clock will only proceed to the next event if all registered channels are empty and the associated actors have finished to process the current event.
In order to integrate into the `DiscreteEvents` framework, Actors register their channels to the `clock.channels` vector. Then the clock will only proceed to the next event if all registered channels are empty and the associated Actors have finished to process the current event.

Even if Actors have registered their message channel to the clock, they should use [`now!`](@ref) for IO-operations or print via the clock. This also makes them responsive and does not yield them to the scheduler during their loop.

## Actor potential

See the [companion site](https://pbayer.github.io/DiscreteEventsCompanion.jl/dev/actors/) for code examples with actors and [`YAActL`](https://pbayer.github.io/YAActL.jl/dev/). `YAActL` provides `register!` for integration into the `DiscreteEvents` framework.
See the [companion site](https://pbayer.github.io/DiscreteEventsCompanion.jl/dev/actors/) for more explanations and examples with Actors. [`YAActL`](https://pbayer.github.io/YAActL.jl/dev/) provides `register!` for integration into the `DiscreteEvents` framework.

Despite of minimal actor support, a lot can be done yet with actors. Actors push the boundaries of discrete event simulation.
Despite of minimal actor support, a lot can be done yet with Actors. Actors push the boundaries of discrete event simulation.

0 comments on commit 50987d2

Please sign in to comment.