Skip to content

Commit

Permalink
Added Pipeline with deadlines
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardalee committed Nov 28, 2024
1 parent 8b9b641 commit 2886bf5
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
35 changes: 35 additions & 0 deletions examples/C/src/patterns/Pipeline.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Pipeline pattern where a periodic source feeds a chain of reactors that can all execute in
* parallel at each logical time step. This example shows how a deadline can interfere with
* parallelism if the GEDF_NP scheduler is used. The target parameter `scheduler` overrides
* the default scheduler to use the NP scheduler, which results in fully parallel execution.
*
* @author Edward A. Lee
*/
target C {
scheduler: NP,
timeout: 1 sec
}

import SendCount, Receive from "lib/SendersAndReceivers.lf"
import TakeTime from "lib/TakeTime.lf"

reactor Deadline extends TakeTime {
reaction(in) {=
=} deadline (100 ms) {=
=}
}

federated reactor {
r0 = new SendCount(period = 100 msec)
r1 = new TakeTime(approximate_time = 100 msec)
r2 = new TakeTime(approximate_time = 100 msec)
r3 = new TakeTime(approximate_time = 100 msec)
r4 = new Deadline(approximate_time = 100 msec)
r5 = new Receive()
r0.out -> r1.in after 100 msec
r1.out -> r2.in after 100 msec
r2.out -> r3.in after 100 msec
r3.out -> r4.in after 100 msec
r4.out -> r5.in after 100 msec
}
4 changes: 4 additions & 0 deletions examples/C/src/patterns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ This directory contains Lingua Franca programs representing a number of common d
<td> <img src="img/Simultaneity.png" alt="Simultaneity" width="50%"> </td>
<td> <a href="Simultaneity.lf"> Simultaneity.lf</a>: An illustration of logical simultaneity. </td>
</tr>
<tr>
<td> <img src="img/Pipeline.png" alt="Simultaneity" width="100%"> </td>
<td> <a href="Pipeline.lf"> Pipeline.lf</a>: An illustration parallelism with deadlines. </td>
</tr>
</table>


Expand Down
Binary file added examples/C/src/patterns/img/Pipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2886bf5

Please sign in to comment.