comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Question about concurrent access to array
Date: Thu, 14 Feb 2013 16:53:57 -0500
Date: 2013-02-14T16:53:57-05:00	[thread overview]
Message-ID: <wcchale5zpm.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: bf027023-8b59-4d12-a077-d2e757a5a58d@googlegroups.com

Adam Beneschan <adam@irvine.com> writes:

> I'd use an alignment aspect (or representation clause) to make sure
> that the array elements are aligned on some boundary, probably based
> on the largest integer that your machine can deal with.

That's not necessary for correctness.  It might be necessary to avoid
false sharing of cache lines, as Niklas Holsti mentioned.  Depends on
the machine.

>...Otherwise
> there's the risk that two consecutive array elements that "belong" to
> different tasks might share part of a "word" (or something), and the
> code to write into an element might involve reading the entire word,
> modifying part of the word, then writing it back.

That would be incorrect code generation, assuming there's no Pack
or Component_Size clause.

- Bob



  reply	other threads:[~2013-02-14 21:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 20:39 Question about concurrent access to array john
2013-02-14 21:29 ` Adam Beneschan
2013-02-14 21:53   ` Robert A Duff [this message]
2013-02-14 23:31     ` Adam Beneschan
2013-02-15  9:11       ` cjpsimon
2013-02-14 21:41 ` Niklas Holsti
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox