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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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-19 19:23:07 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!green.octanews.net!news.octanews.net!news-xfer.cox.net!peer01.cox.net!cox.net!border3.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.gbronline.com!news.gbronline.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 19 Dec 2003 21:23:05 -0600 Date: Fri, 19 Dec 2003 22:23:46 -0500 From: Wes Groleau Reply-To: groleau@freeshell.org Organization: Ain't no organization here! User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5.1) Gecko/20031120 X-Accept-Language: en-us, en, es-mx, pt-br, fr-ca MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: A common array References: <3fe0d45e$1@news.barak.net.il> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 69.9.86.63 X-Trace: sv3-a7v0Ck0R8K9X/hn0/baab13WO0n5utqo+TDNB9Xfi8r+yH5ESVu2f+CTXfn5zS055nqwC1xS8hvakPb!VnJw3J5Z5zzVGaFJsg6LhnywwUXZzSdUv1r+Kq+N34r3hwy3mIh7c44UicZL16paXTnTdqMDj1Fz X-Complaints-To: abuse@gbronline.com X-DMCA-Complaints-To: abuse@gbronline.com 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:3607 Date: 2003-12-19T22:23:46-05:00 List-Id: Mr. J. wrote: > I need to write a procedure that checks and prints the prime numbers > between 1 and m. > The procedure gets 2 parameter, m- the numbers to check 1..m and n - > the number of tasks to perform it. > > each tak will check if a number is a prime number, and will update an > array of booleans (size 1..m). > At the end of all tasks the procedure prints the prime numbers. Still not quite clear. Does each task update one cell, and no other task updates that cell? IF that is the case, then the cells do not need synchronization. But IF one task implements a divisor, for example, setting false every third cell, while another (for example) sets false every fifth cell, then they could theoretically collide on the fifteenth cell. You could say, "it's so unlikely for that to happen at the same time that I don't need to protect the cells." Or you could play it safe and make each cell a protected object. (Not the whole array--why lock all tasks out of cell X just because somebody is writing to cell Y?) However, IF each task is only writing False into Boolean cells initialized to True, then a collision can't hurt anything. It ends up False no matter who gets there first. -- Wes Groleau When all you have is a perl, everything looks like a string.