From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6f1d6da490488dc7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-20 10:06:32 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 20 Dec 2003 12:06:30 -0600 Date: Sat, 20 Dec 2003 13:06:30 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A common array References: <3fe0d45e$1@news.barak.net.il> <3fe415d7$1@news.barak.net.il> In-Reply-To: <3fe415d7$1@news.barak.net.il> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.34.214.193 X-Trace: sv3-onSvZUB9cwI8EP2iXsP5YcRrdO11SzWZO+vy03w572hs47/6B4HydQUUft/iI23Kn4qj2d1t9XhCnA8!afHcgndEEEwBJDPkrQGLGtrXbGaBgmRz47oM7w8mcJeMfWpqXyBNx7W3FHN/cQ== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:3633 Date: 2003-12-20T13:06:30-05:00 List-Id: First, this looks like a homework assignment. Doesn't mean you won't get help here, just that people are less likely to provide code instead of understanding. Ratson Janiv wrote: > Thanks I understand that, in my case a cell in the arrray will be updated > only once. Don't forget to mark the array in some way so that the elements can be separately addressed. Look at pragma Atomic, and pragma Atomic_Elements to decide how you want to address this. > The other unsolved problem is that I dont know how to reallocate a number to > a task. > If I check numbers between 1..100, and I only have 8 tasks, The manager task > willhave to reuse teh tasks to keep checking the other numbers. hence, a > manager should reallocate a new number to a task that has finished checking > the previous number. > I though about a notification mechanism, hence, each check task will notify > the manager task that it finished checking, and the manager task will > reallocate a new number to that task. My problem is that I do not know how > the Manager Task will know which task has notified it. > Any ideas how to solve this problem ? M I in the right though about > notification, or there is a better way ? There are several ways to do this. First you can have a task (or tasks) that hands out numbers to be checked during a rendezvous. Second you can have a protected object, or objects that hand out numbers to be checked. In other words the protected object would contain a procedure that returns a new value to check as an out parameter. You can have the value returned by a function in the protected object, but this is tricky. If you can figure it out, you will see that the actual function called need not be protected at all. Finally you can pass each task a set of numbers to check when it is created. This is a much more efficient solution since it allows you to minimize the interactions between tasks. If I was writing this, this is the way I would go. Further, I would have the task provide results in batches--IF that made things faster. It may not, that will depend on the compiler you use, the hardware architecture, and other decisions you make in your program design. -- Robert I. Eachus "The war on terror is a different kind of war, waged capture by capture, cell by cell, and victory by victory. Our security is assured by our perseverance and by our sure belief in the success of liberty." -- George W. Bush