Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n = 0; // global variable n
- //process p
- active proctype p(){
- int counter = 0; // local counting variable for process p
- do
- :: counter < 10 -> // untill the local counter does not reach ten
- int temp;
- temp = n; // use auxiliary variable
- n = temp + 1; // to increment global variable n
- counter ++; // increase counter after incrementing n
- :: counter >= 10 -> break; // when the local counter reaches 10, terminate process
- od
- }
- //process q
- active proctype q(){
- int counter = 0; // local counting variable for process p
- do
- :: counter < 10 -> // untill the local counter does not reach ten
- int temp;
- temp = n; // use auxiliary variable
- n = temp + 1; // to increment global variable n
- counter ++; // increase counter after incrementing n
- :: counter >= 10 -> break // when the local counter reaches 10, terminate process
- od
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement