(+84) 236.3827111 ex. 402

Phép toán Concurrency


Cú pháp:

Concurrency(TaskA,TaskB,PA0,Cond1,PA1,cond2,PA2,…,Condn,PAn)

Trong đó 0< PAi <1 iÎ [0,n], condi Îbool,condi là các biên kiểu boolean.

Hành vi hoạt động của phép toán được trình bày như sau:

do

{n= rand(1)

if (Cond1== TRUE){

if (n<= PA1) Action_From_TaskA;

else Action_from_TaskB;

}

else if (Cond2== TRUE)

if (n<= PA2) Action_From_TaskA;

else Action_from_TaskB;

else if (Condn== TRUE)

if (n<= PAn) Action_From_TaskA;

else Action_from_TaskB;

else

if (n<= PA0) Action_from_TaskA;

else Action_from_TaskB;

if TaskA is finished

all remaining actions of TaskB are executed;

if TaskB is finished

all remaining actions of TaskA are executed;

} while (all actions from taskA and TaskB haven’t executed yet)


[n1]cũng định nghĩa bằng BNF như trên

[n2]có vấn đề -> ko logic với cú pháp TTT ở trên

[n3]dùng begin?