Previous Next Contents

4.5   Bag of Tasks

foreach job J 
   J.state <- UNSTARTED
foreach worker W
   W.state <- IDLE
forever do 
   while (E(J:J.state=UNSTARTED) & E(W:W.state=IDLE))
      J.state <- RUNNING
      W.job   <- J
      W.state <- BUSY
   if (!E(W:W.state=BUSY))
      break
   wait for reply from worker (W)
   W.job.state <- FINISHED
   W.state     <- IDLE
      







Previous Next Contents