next up previous contents
Next: Correctness Up: Program Design Previous: Stored Tree

Unstored Recursion

This algorithm is built from the previous algorithm it is different in that it does not need to store the tree. From my experience with the Stored Tree algorithm I realized that storing the tree was not needed. Using the fact that the recursion path of the findleast and the buildtree were the same I could combine the two functions and only store one limb (from root to leaf) of the complete tree. To keep from storing the complete tree the recursion passes the summed times of the processors each time. To solve the problem of not saving the ordering that is least I created three stacks and pushed which task went on which processor for each recursive call, upon returning from the call the information was popped and discarded. Here is pseudo-code for the new algorithm:

 call(P1, P2, P3, addtask)

if addtask = n do

if max(P1, P2, P3) < lowest do

changelowest(max(P1,P2,P3))

else

inc(addtask)

p1s.push(addtask)

call( tex2html_wrap_inline288 )

p1s.pop(popped)

p2s.push(addtask)

call( tex2html_wrap_inline292 )

p2s.pop(popped)

p3s.push(addtask)

call( tex2html_wrap_inline296 )

p3s.pop(popped)

taskweight is the same as in the first algorithm a two dimensional array. The changelowest function simply reassigns lowest and stores the current stacks into a separate stacks.



Jamie Marconi
Thu May 23 20:07:44 PDT 1996