global glob; int x = 0; sem mutex = 1 body glob final { write(x) } end resource test(int N, int n, cap () signal) import glob process p [i=1 to N] { P(mutex); x+=n; V(mutex); send signal() } end resource main() import test const int N = 5; op done() cap vm vmcap cap test t1, t2 t1 = create test(N,1,done) vmcap = create vm() on "tabora" t2 = create test(N,2,done) on vmcap for [i=1 to 2*N] { receive done() } destroy t1; destroy t2; destroy vmcap end