[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlaplus] Re: Confirmation of sequence of execution in model
Stephan, I need did look at Hillel's book, and LL's PlusCal PDF. Quoting from LL's book (https://lamport.azurewebsites.net/tla/p-manual.pdf) pg52:
"An atomic operation of an algorithm consists of all control paths that start at some label l, end at a label, and do not pass through any label. For example, this code sequence ... An action A is said to be enabled in a state s iff it is possible to perform an A action in state s—that is, iff there is some state t such that s → t is an A step. For each atomic operation L of a PlusCal algorithm, the TLA+ translation defines an action L that represents the operation—in other words, where s → t is an L step iff executing operation L in state s can produce state t. We call L an atomic action of the algorithm. A"
What these sources somewhat avoid is the following. Suppose I want to push an element, then wait an arbitrary time, then pop it.
process Worker \in 1..MaxProcesses
begin
i1: call push (10,self);
i2: call pop();
end process;
is just wrong. since i1: and i2: are both enabled TLA can try both.
This is wrong too because no time will pass after i1 before i2 because they are done atomically in a single step:
process Worker \in 1..MaxProcesses
begin
i1: call push (10,self);
call pop();
end process;
So what I failed to understand is how to transform this code:
process Worker \in 1..MaxProcesses
begin
i1: call push (10,self);
i2: call pop();
end process;
such that i2 may only start arbitrarily after i1 is done .... i2 needs some sort of await or other condition to hold it until i1 is done. I gather this sort of sync --- different in mind set from plain-jane programming --- is what I'm missing?
--
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+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to tlaplus@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/tlaplus.
For more options, visit https://groups.google.com/d/optout.