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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,904e84d5dc020db1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.155.41 with SMTP id vt9mr835669pab.11.1360877388660; Thu, 14 Feb 2013 13:29:48 -0800 (PST) X-Received: by 10.50.196.135 with SMTP id im7mr119072igc.1.1360877388412; Thu, 14 Feb 2013 13:29:48 -0800 (PST) Path: jm3ni9pbb.0!nntp.google.com!kc14no1022008pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 14 Feb 2013 13:29:47 -0800 (PST) In-Reply-To: <947b0951-54e4-4a4d-bd26-760eb66390c3@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 References: <947b0951-54e4-4a4d-bd26-760eb66390c3@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Question about concurrent access to array From: Adam Beneschan Injection-Date: Thu, 14 Feb 2013 21:29:48 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2013-02-14T13:29:47-08:00 List-Id: On Thursday, February 14, 2013 12:39:01 PM UTC-8, jo...@peppermind.com wrot= e: > I'd like like several tasks to share an unpacked array of a definite disc= riminant record type. >=20 > 1.) Is this possible? I don't see why it wouldn't be. > 2.) Do I need any kind of synchronization if I can guarantee that every t= ask can only write and read to a different area (different range of indices= ) in the array?=20 >=20 > Performance matters a lot in this case, which is why I would prefer not t= o use a protected object or any other synchronization mechanism. I can't im= agine how a problem could occur if every task only accesses his own part of= the array, but perhaps there is still one? I'd use an alignment aspect (or representation clause) to make sure that th= e array elements are aligned on some boundary, probably based on the larges= t integer that your machine can deal with. Otherwise there's the risk that= two consecutive array elements that "belong" to different tasks might shar= e part of a "word" (or something), and the code to write into an element mi= ght involve reading the entire word, modifying part of the word, then writi= ng it back. If you do this, then I don't see how there could be a problem.= But that doesn't mean there isn't one. -- Adam