resource helper op my_age(ref a: int) body helper(id, nap_time : int) write("helper", id, "is alive, nap_time=", nap_time) process help nap(1000*nap_time) end help proc my_age(a) write("helper", id, "started with a=", a) a := age() end my_age end helper resource user() import helper var num_helpers : int := 5, nap_time : int := 3 getarg(1, num_helpers); getarg(2, nap_time) write("resource user starting,", num_helpers, "helpers,", nap_time, "napping time") var machine_name : string[64] var machine_cap[1:num_helpers] : cap vm var hcap[1:num_helpers] : cap helper fa i := 1 to num_helpers -> getarg(2+i, machine_name) machine_cap[i] := create vm() on machine_name write("Virtual machine starting up on machine", machine_name) af fa i := 1 to num_helpers -> hcap[i] := create helper(i, nap_time) on machine_cap[i] af final var a : int := 777 fa i := 1 to num_helpers -> hcap[i].my_age(a) write("final age in helper", i, "is", a) af end end user /* ............... Example compile and run(s) % sr -o multiple_machines multiple_machines.sr % ./multiple_machines 3 2 violet lily rose resource user starting, 3 helpers, 2 napping time Virtual machine starting up on machine violet Virtual machine starting up on machine lily Virtual machine starting up on machine rose helper 1 is alive, nap_time= 2 helper 2 is alive, nap_time= 2 helper 3 is alive, nap_time= 2 helper 1 started with a= 294096 final age in helper 1 is 777 final age in helper 2 is 777 helper 3 started with a= 294128 helper 2 started with a= 294128 final age in helper 3 is 777 */