-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v02 (FSM): State graph for minimum configuration.
- Loading branch information
Showing
6 changed files
with
197 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Get (nightly) TLC | ||
run: wget https://nightly.tlapl.us/dist/tla2tools.jar | ||
- name: Run TLC | ||
run: java -Dtlc2.TLC.stopAfter=1800 -Dtlc2.TLC.ide=Github -Dutil.ExecutionStatisticsCollector.id=1efd5c60f238424fa70d124d0c77bbf1 -cp tla2tools.jar tlc2.TLC -workers auto -lncheck final -checkpoint 60 -coverage 60 -tool -deadlock BlockingQueue | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
\* SPECIFICATION | ||
CONSTANTS | ||
BufCapacity = 1 | ||
Producers = {p1} | ||
Consumers = {c1} | ||
|
||
INIT Init | ||
NEXT Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--------------------------- MODULE BlockingQueue --------------------------- | ||
(***************************************************************************) | ||
(* Original problem and spec by Michel Charpentier *) | ||
(* http://www.cs.unh.edu/~charpov/programming-tlabuffer.html *) | ||
(***************************************************************************) | ||
EXTENDS Naturals, Sequences, FiniteSets | ||
|
||
CONSTANTS Producers, (* the (nonempty) set of producers *) | ||
Consumers, (* the (nonempty) set of consumers *) | ||
BufCapacity (* the maximum number of messages in the bounded buffer *) | ||
|
||
ASSUME Assumption == | ||
/\ Producers # {} (* at least one producer *) | ||
/\ Consumers # {} (* at least one consumer *) | ||
/\ Producers \intersect Consumers = {} (* no thread is both consumer and producer *) | ||
/\ BufCapacity \in (Nat \ {0}) (* buffer capacity is at least 1 *) | ||
|
||
----------------------------------------------------------------------------- | ||
|
||
VARIABLES buffer, waitSet | ||
vars == <<buffer, waitSet>> | ||
|
||
RunningThreads == (Producers \cup Consumers) \ waitSet | ||
|
||
(* @see java.lang.Object#notify *) | ||
Notify == IF waitSet # {} | ||
THEN \E x \in waitSet: waitSet' = waitSet \ {x} | ||
ELSE UNCHANGED waitSet | ||
|
||
(* @see java.lang.Object#wait *) | ||
Wait(t) == /\ waitSet' = waitSet \cup {t} | ||
/\ UNCHANGED <<buffer>> | ||
|
||
----------------------------------------------------------------------------- | ||
|
||
Put(t, d) == | ||
\/ /\ Len(buffer) < BufCapacity | ||
/\ buffer' = Append(buffer, d) | ||
/\ Notify | ||
\/ /\ Len(buffer) = BufCapacity | ||
/\ Wait(t) | ||
|
||
Get(t) == | ||
\/ /\ buffer # <<>> | ||
/\ buffer' = Tail(buffer) | ||
/\ Notify | ||
\/ /\ buffer = <<>> | ||
/\ Wait(t) | ||
|
||
----------------------------------------------------------------------------- | ||
|
||
(* Initially, the buffer is empty and no thread is waiting. *) | ||
Init == /\ buffer = <<>> | ||
/\ waitSet = {} | ||
|
||
(* Then, pick a thread out of all running threads and have it do its thing. *) | ||
Next == \E t \in RunningThreads: \/ /\ t \in Producers | ||
/\ Put(t, t) \* Add some data to buffer | ||
\/ /\ t \in Consumers | ||
/\ Get(t) | ||
|
||
============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
strict digraph DiskGraph { | ||
nodesep=0.35; | ||
subgraph cluster_graph { | ||
color="white"; | ||
1361886694690155653 [label="/\\ buffer = <<>>\n/\\ waitSet = {}",style = filled] | ||
1361886694690155653 -> 8427788535082373079 [label="",color="black",fontcolor="black"]; | ||
8427788535082373079 [label="/\\ buffer = <<p1>>\n/\\ waitSet = {}"]; | ||
1361886694690155653 -> -7172793711072072991 [label="",color="black",fontcolor="black"]; | ||
-7172793711072072991 [label="/\\ buffer = <<>>\n/\\ waitSet = {c1}"]; | ||
8427788535082373079 -> -6634559038400111083 [label="",color="black",fontcolor="black"]; | ||
-6634559038400111083 [label="/\\ buffer = <<p1>>\n/\\ waitSet = {p1}"]; | ||
8427788535082373079 -> 1361886694690155653 [label="",color="black",fontcolor="black"]; | ||
-7172793711072072991 -> 8427788535082373079 [label="",color="black",fontcolor="black"]; | ||
-6634559038400111083 -> 1361886694690155653 [label="",color="black",fontcolor="black"]; | ||
{rank = same; 1361886694690155653;} | ||
{rank = same; 8427788535082373079;-7172793711072072991;} | ||
{rank = same; -6634559038400111083;} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.