Grid Computing & the Linda Programming Model
by Rob Bjornson and Andrew Sherman


Example 1:

(a)
worker()
{
   RESULT r;
   TASK t;

   while (1) {
     ts.in("task", ?t);
        transaction(ts);
        r = compute_task(t);
        ts.out("result", r);
     commit(ts);
  }
}

(b)
master()
{
   int i;
   RESULT r;
   TASK t;
   for (i=0; create_task(&t);i++)
      ts.out("task",t);
   for (;i;--i){
      ts.in("result",?r);
      update_result(r);
   }
   output_result(r);
}





1


