Mercurial > hg > Members > nobuyasu > Spin
view promela/alt4.pml @ 0:86e67be8bc5f draft
add some files
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 29 Jun 2012 01:14:43 +0900 |
parents | |
children |
line wrap: on
line source
// Multiple Process to run alternately // atomic operation // assert mtype = { F, S }; mtype turn = F; pid who; active [2] proctype Producer() { do :: atomic{ (turn == F ) -> who = _pid }; printf("Producer-%d\n",_pid); assert(who == _pid); turn = S; od } active [2] proctype Consumer() { do :: atomic{ (turn == S) -> who = _pid }; printf("Consumer-%d\n",_pid); assert(who == _pid); turn = F; od }