/\ toSend = 10
/\ pc = [S |-> "l_send", R |-> "Done"]
CONSTANT PckCount
ASSUME PckCount \in Nat \ {0}
--fair algorithm simple
{
variables msgC = <<>>; ackC = <<>>;
macro Send(m, chan) {
chan := Append(chan, m)
}
macro Rcv(v, chan) {
await chan /= <<>>;
v := Head(chan);
chan := Tail(chan);
}
process (Sender = "S")
variables toSend = 0; ack = 0;
{
l_send:
while (toSend < PckCount) {
either {
Send(toSend, msgC);
}
or {
Rcv(ack, ackC);
l_depart:
\* if ack received, send next two packets
if (ack = (toSend + 1)) {
toSend := ack;
}
}
}
}
process (Receiver = "R")
variables next = 0; msg = 0;
{
l_rcv:
while (next < PckCount) {
either {
Send(next, ackC);
}
or {
Rcv(msg, msgC);
l_accept:
if (msg = next) {
next := next + 1 ;
}
}
};
l_finish_rcv:
Send(next, ackC);
}
}
Meanwhile, I don't have enough information to understand what you are
doing. For one thing, you never said what liveness property you were
checking. However, I doubt that there is any sensible liveness
property satisfied by your algorithm. And it generates an infinite
number of states, so I don't know you were trying to model check it.
For example, there is a behavior that consists of nothing but the
Sender executing an infinite sequence of Send actions. If you had
added fairness conditions to each process instead of just to the
entire algorithm, there would still be behaviors that consist of
nothing but the Sender and Receiver both executing an infinite
sequence of Send actions.
I suspect that you don't understand fairness, and that you seem to
think there is some sort of fairness condition on the choices in an
either/or construct. You should understand that the following
piece of code allows a behavior that loops forever, generating an
infinite number of different states:
a: x := 1 ;
b: while (x # 0) {
either x := 0
or x := x+1;
}
You probably need to study the meaning of fairness, either from
the Hyperbook or Specifying Systems.
Leslie
I'm sorry, I cannot see why the while loop in this process must
terminate. (Or the corresponding one for the Receiver.)
process (Sender = "S")
variables toSend = 0; ack = 0;
{
l_send:
while (toSend < PckCount) {
either {
Send(toSend, msgC);
}
or {
Rcv(ack, ackC);
l_depart:
\* if ack received, send next two packets
if (ack = (toSend + 1)) {
toSend := ack;
}
}
}
}
Yes, the new version is 1.4.9.
(********************************************
--algorithm dum
{
variables msgC = <<>>;
fair process (Sender = "S")
variables toSend = 0; ack = 0;
{
l_send:
while (toSend < 1) {
msgC := Append(msgC, toSend);
}
}
}
*********************************************)
--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+u...@googlegroups.com.
To post to this group, send email to tla...@googlegroups.com.
Visit this group at http://groups.google.com/group/tlaplus.
For more options, visit https://groups.google.com/d/optout.
/\ Spec
/\ SF_vars (Sender /\ (ackC' /= ackC ))
/\ SF_vars (Sender /\ (msgC' /= msgC))
/\ SF_vars (Receiver /\ (ackC' /= ackC ))
/\ SF_vars (Receiver /\ (msgC' /= msgC))
--
You received this message because you are subscribed to a topic in the Google Groups "tlaplus" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tlaplus/BTqA3O-ipZo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tlaplus+u...@googlegroups.com.
That means "either" clause of "Sender" process is continuously enabled.