Skip to content

Commit

Permalink
v08 (continue): Infer inequation under which the system is deadlock f…
Browse files Browse the repository at this point in the history
…ree.
  • Loading branch information
lemmy committed Sep 25, 2024
1 parent 553287f commit 8e536cb
Show file tree
Hide file tree
Showing 9 changed files with 11,561 additions and 2 deletions.
2 changes: 1 addition & 1 deletion BlockingQueue.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CONSTANTS
BufCapacity = 3
Producers = {p1,p2,p3,p4}
Consumers = {c1,c2,c3}
Consumers = {c1,c2,c3,c4}

INIT Init
NEXT Next
Expand Down
4 changes: 3 additions & 1 deletion BlockingQueue.tla
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ TypeInv == /\ buffer \in Seq(Producers)
/\ waitSet \subseteq (producers \cup consumers)

(* No Deadlock *)
Invariant == waitSet # (producers \cup consumers)
Invariant == IF waitSet # (producers \cup consumers)
THEN TRUE \* Inv not violated.
ELSE PrintT(<<"InvVio", bufCapacity, Cardinality(producers \cup consumers)>>) /\ FALSE

(* The Permutations operator is defined in the TLC module. *)
Sym == Permutations(Producers) \union Permutations(Consumers)
Expand Down
33 changes: 33 additions & 0 deletions R/ContinueInequation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
library(ggplot2)

data <- read.table(sep=",",header=T,text="vio,x,y
n, 1, 2
d, 1, 3
d, 1, 4
d, 1, 5
d, 1, 6
d, 1, 7
d, 1, 8
n, 2, 2
n, 2, 3
n, 2, 4
d, 2, 5
d, 2, 6
d, 2, 7
d, 2, 8
n, 3, 2
n, 3, 3
n, 3, 4
n, 3, 5
n, 3, 6
d, 3, 7
d, 3, 8")

ggplot(data, aes(x=x, y=y, shape=vio, group=vio)) +
geom_point(size=3) +
scale_shape_identity()+
xlab("bufCapacity")+
ylab("|producers \\cup consumers|")+
annotate("segment", x = 1, xend = 3, y = 2.5, yend = 6.5,
colour = "blue")+
scale_x_continuous(breaks=c(1,2,3))
328 changes: 328 additions & 0 deletions R/ContinueInequation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions R/TraceLength.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
setwd("/home/markus/src/TLA/models/tutorials/BlockingQueueTLA/R")
data <- read.csv(header=TRUE, file = 'TraceLength.csv')

# Rename column headers for readability.
colnames(data)
names(data)[names(data) == "cons_prod"] <- "|Cons U Prod|"
names(data)[names(data) == "prod"] <- "|Prod|"
names(data)[names(data) == "cons"] <- "|Cons|"


##install.packages("scatterplot3d")
#library(scatterplot3d)
#scatterplot3d(
# data[,1:3], pch = 19, color = "steelblue",
# grid = TRUE, box = FALSE,
# mar = c(3, 3, 0.5, 3)
#)

##install.packages("GGally")
library(GGally)
library(ggplot2)
ggpairs(data)

##install.packages("ggcorrplot")
library("ggcorrplot")
my_data <- data[, c(1,2,3,4,5)]
corr <- round(cor(my_data), 1)
ggcorrplot(corr, p.mat = cor_pmat(my_data),
hc.order = TRUE, type = "lower",
color = c("#FC4E07", "white", "#00AFBB"),
outline.col = "white", lab = TRUE)
256 changes: 256 additions & 0 deletions R/TraceLength.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
BufCapacity, cons_prod, prod, cons, Length
1, 10, 2, 8, 14
1, 10, 2, 8, 15
1, 10, 3, 7, 14
1, 10, 3, 7, 15
1, 10, 4, 6, 14
1, 10, 4, 6, 15
1, 10, 5, 5, 14
1, 10, 5, 5, 15
1, 10, 6, 4, 14
1, 10, 6, 4, 15
1, 10, 7, 3, 14
1, 10, 7, 3, 15
1, 10, 8, 2, 14
1, 10, 8, 2, 15
1, 11, 3, 8, 15
1, 11, 3, 8, 16
1, 11, 4, 7, 15
1, 11, 4, 7, 16
1, 11, 5, 6, 15
1, 11, 5, 6, 16
1, 11, 6, 5, 15
1, 11, 6, 5, 16
1, 11, 7, 4, 15
1, 11, 7, 4, 16
1, 11, 8, 3, 15
1, 11, 8, 3, 16
1, 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 2, 7, 13
1, 9, 2, 7, 14
1, 9, 3, 6, 13
1, 9, 3, 6, 14
1, 9, 4, 5, 13
1, 9, 4, 5, 14
1, 9, 5, 4, 13
1, 9, 5, 4, 14
1, 9, 6, 3, 13
1, 9, 6, 3, 14
1, 9, 7, 2, 13
1, 9, 7, 2, 14
1, 9, 8, 1, 14
2, 10, 2, 8, 18
2, 10, 3, 7, 18
2, 10, 3, 7, 22
2, 10, 4, 6, 18
2, 10, 4, 6, 20
2, 10, 5, 5, 18
2, 10, 5, 5, 20
2, 10, 6, 4, 18
2, 10, 6, 4, 20
2, 10, 7, 3, 20
2, 10, 7, 3, 24
2, 10, 8, 2, 20
2, 11, 3, 8, 19
2, 11, 3, 8, 23
2, 11, 4, 7, 19
2, 11, 4, 7, 21
2, 11, 5, 6, 19
2, 11, 5, 6, 21
2, 11, 6, 5, 19
2, 11, 6, 5, 21
2, 11, 7, 4, 19
2, 11, 7, 4, 21
2, 11, 8, 3, 21
2, 11, 8, 3, 25
2, 12, 4, 8, 20
2, 12, 4, 8, 22
2, 12, 5, 7, 20
2, 12, 5, 7, 22
2, 12, 6, 6, 20
2, 12, 6, 6, 22
2, 12, 7, 5, 20
2, 12, 7, 5, 22
2, 12, 8, 4, 20
2, 12, 8, 4, 22
2, 13, 5, 8, 21
2, 13, 5, 8, 23
2, 13, 6, 7, 21
2, 13, 6, 7, 23
2, 13, 7, 6, 21
2, 13, 7, 6, 23
2, 13, 8, 5, 21
2, 13, 8, 5, 23
2, 14, 6, 8, 22
2, 14, 6, 8, 24
2, 14, 7, 7, 22
2, 14, 7, 7, 24
2, 14, 8, 6, 22
2, 14, 8, 6, 24
2, 15, 7, 8, 23
2, 15, 7, 8, 25
2, 15, 8, 7, 23
2, 15, 8, 7, 25
2, 16, 8, 8, 24
2, 16, 8, 8, 26
2, 5, 1, 4, 13
2, 5, 2, 3, 21
2, 5, 3, 2, 23
2, 5, 4, 1, 15
2, 6, 1, 5, 14
2, 6, 2, 4, 14
2, 6, 3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6, 40
4, 9, 3, 6, 57
4, 9, 4, 5, 73
4, 9, 5, 4, 77
4, 9, 6, 3, 61
5, 11, 5, 6, 111
5, 11, 6, 5, 116
5, 12, 6, 6, 72
5, 12, 6, 6, 77
6, 13, 6, 7, 157
Loading

0 comments on commit 8e536cb

Please sign in to comment.