From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 15 Sep 93 13:47:45 GMT From: howland.reston.ans.net!wupost!cs.utexas.edu!utnut!utcsri!csri.toronto.edu !blaak@gatech.edu (Raymond Blaak) Subject: Re: Tasking in Ada Message-ID: <1993Sep15.094745.16963@jarvis.csri.toronto.edu> List-Id: kgatlin@galaxy.csc.calpoly.edu (Kang Su Gatlin) writes: >I have hit a snag with Ada. I need to create dynamic tasks that know which >task they are. ... >I can't seem to find a way to pass information to tasks efficiently. I want >all the tasks to run simultaneously so that the creation and execution of >the tasks can be done in t(1) time. >The only way I can think of how to do it is to loop through and create the >tasks but that is O(n) time. Or I can create an array of tasks (if that is >possible) but then how do I get information to the tasks with using the >rendezvous mechanism (again O(n)). If n is small, then looping through is probably the best way. If n is large then consider the array of tasks as a tree (i.e. the children of task i are tasks 2i and 2i+1) and have each task communicate the identities to its children. This would give you O(log n) time. To start things off you would need only to tell task 1 its identity. At any rate, if your code is running on a serial machine, then simply looping through is faster anyway, for there would be less parallelism being simulated to assign the identities. Cheers, Ray blaak@csri.toronto.edu