Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpreter: bug in parallel action and assignment? #293

Open
richardpaynea55 opened this issue Aug 21, 2014 · 4 comments
Open

Interpreter: bug in parallel action and assignment? #293

richardpaynea55 opened this issue Aug 21, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@richardpaynea55
Copy link
Contributor

This is related to an earlier bug about replicated parallelism. When I use an action with replicated parallelism, only one of the replications allows state to be updated. In the model below:

channels
  inA : nat * nat
  outA : nat * nat

process p = 
begin
  state
    a: nat :=0

  operations
    updateA : nat ==> ()
    updateA(newA) == 
      a := newA

  @ ||| n in set {1,...,3} @ [{}] inA.n!a -> updateA(n); outA!n!a -> Skip

end

I obtain various trace options, including:

[inA.3.0, outA.3.3, inA.1.0, outA.1.0, inA.2.0, outA.2.0]
[inA.1.0, outA.1.0, inA.3.0, outA.3.3, inA.2.0, outA.2.0]

It appears that the state variable a is updated only when n=3. I am assuming there is no shared state (which would result in a=6), and it seems that only one of the replication branches allows assignments to hold.

@joey-coleman joey-coleman self-assigned this Aug 21, 2014
@lausdahl lausdahl changed the title Interpreter bug in parallel action and assignment? Interpreter: bug in parallel action and assignment? Aug 22, 2014
@lausdahl
Copy link
Contributor

Is this what you expected:

inA.2.0,inA.3.0,inA.1.0,outA.1.1,outA.3.3,outA.2.2

@joey-coleman
Copy link
Member

I doubt it's what Richard expected, but that is one (of perhaps 8) possible valid traces.

@richardpaynea55
Copy link
Contributor Author

It was not what I'd hoped, but Kenneth and I discussed this and agree that this is the correct behaviour, where the action:

@ (||| n in set {1,...,3} @ [{a}] inA.n!a -> updateA(n); outA!n!a -> Skip); finalout!a -> Skip 

would result in a sample trace:

[inA.2.0,inA.3.0,inA.1.0,outA.1.1,outA.3.3,outA.2.2,finalout.0]

i.e. the local variable a is destroyed. We assume that there is no way to obtain the value a at the end of the replication.

@lausdahl
Copy link
Contributor

Currently the value finalout.x will be the a state of the last one executed. This is because no delayed context is wrapped around the last branch of of the replicated AST.

@joey-coleman joey-coleman added this to the 0.5.0 milestone Sep 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants