comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Re: Scheduling behaviour issue
Date: Wed, 22 Apr 2020 17:47:08 -0700 (PDT)
Date: 2020-04-22T17:47:08-07:00	[thread overview]
Message-ID: <6cd92320-4c1b-4e3e-aa34-c31b54580d2c@googlegroups.com> (raw)
In-Reply-To: <hgbt0pFf4o0U1@mid.individual.net>

On Wednesday, April 22, 2020 at 5:58:52 PM UTC-4, Niklas Holsti wrote:
> On 2020-04-22 23:41, AdaMagica wrote:
> > Am Mittwoch, 22. April 2020 20:03:56 UTC+2 schrieb Niklas Holsti:
> >> Under RTEMS, if there are higher-priority tasks on that processor core,
> >> such actions on shared data would not have this mutual-exclusion
> >> property, and the shared data could be messed up. However, I'm not sure
> >> if such use of shared data is "correct" per the Ada RM, and if the
> >> resulting mess can be called "misbehaviour".
> > 
> > This is the reasoning of Ada 83 (RM 9.11 Shared Variables):
> 
>     [snipped]
> 
> > I'm too lazy to search for the relevant text in current Ada, but as
> > far as I can tell, this principle is still valid.
> 
> <SNIPPED>
>
> In this connection I want to ask if the "Discussion" in RM 2012 
> 9.10(15.b) uses a valid example. The Discussion says that two 
> "sequential" assignments to the same variable, where neither "signals" 
> the other, are not erroneous, because there may be cases where the order 
> in which the assignments are executed makes no difference. The 
> Discussion gives, as an example, assignments that just "accumulate 
> aggregate counts". It seems to me that the order of two such assignments 
> to the same counter does matter, because the values written may be 
> different, as in the counter-increment example above. Am I right? If so, 
> this example seems wrong for this Discussion (also in Ada 202X ARM).

It's definitely worded awkwardly.  The text is correct that 
it isn't a data race and therefor erroneous, but I think you
are correct that there is a potential race condition there
where the counter could get incremented to the same value
twice, losing a count (assuming I am reading it correctly).

  reply	other threads:[~2020-04-23  0:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 11:34 Scheduling behaviour issue Simon Wright
2020-04-22 16:16 ` fabien.chouteau
2020-04-22 17:20   ` Simon Wright
2020-04-22 18:05     ` Anh Vo
2020-04-22 18:21       ` Niklas Holsti
2020-04-22 18:03 ` Niklas Holsti
2020-04-22 20:41   ` AdaMagica
2020-04-22 21:58     ` Niklas Holsti
2020-04-23  0:47       ` Jere [this message]
2020-04-23 10:56   ` Simon Wright
2020-04-23 12:38     ` Niklas Holsti
2020-04-23 12:57     ` Niklas Holsti
2020-04-23 11:48 ` Simon Wright
2020-04-23 13:18 ` 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