Sunday, 15 February 2015

concurrency - Maximum and minimum value of cobegin/coend block -



concurrency - Maximum and minimum value of cobegin/coend block -

based on next code, need find minimum , maximum final values of x

x=1 i=1 cobegin while (i<4) while (i<4) begin begin x=x*2 x=x*2 i=i+1 i=i+1 end end coend

i figured minimum value x can have 8, if the loops executed in order. , maximum value x can have 16, if programme enters 1 of loops first, switches other loop , execute until x=8 , i=4, , finishes first loop, x=16 , i=5. correct? missing case x either greater or lower?

the answers came correct!

concurrency operating-system

No comments:

Post a Comment