[fpc-devel] volatile variables
DrDiettrich1 at aol.com
Tue Jun 28 22:49:10 CEST 2011
Andrew Brunner schrieb:
> On Tue, Jun 28, 2011 at 9:33 AM, Michael Schnell <mschnell at lumino.de> wrote:
>> And this has been discussed in the other message: If the variable in fact is
>> global the compiler needs to avoid caching it, if it is static and the
>> function is in another module it might still decide to cache it, but you are
>> right: it is not likely that it does make this difference.
> Well, I think one issue is that each core has it's own cache.
> 1.) How can we get the core to not relent and have the code handed off
> to another core until we're finished?
Never, in a preemptive multi-tasking environment.
It's easier to *encourage* such swapping, by inserting Sleep calls.
> 2.) How can we get the core to have a synchronised copy of a
> particular variable (aside from CAS)?
How can we get *unsynchronized* copies of the same variable, to prove
the need for explicit synchronization? And how to prove that the copies
*are* different, with means that do not happen to enforce synchronicity
Please note that we'll have to restrict the sample code in a way, that
leaves *no* room for *accidental* concurrent access, bypassing the
one-thread-only access protection.
More information about the fpc-devel