Date: Thu, 11 Jun 2026 10:09:03 -0700
On Wednesday, 10 June 2026 21:20:37 Pacific Daylight Time Tiago Freire via Std-
Discussion wrote:
> And as we have discussed those concrete machines don't really respect "order
> of execution", unless you put barriers everywhere, and nobody would want
> that because that would make things painfully slow.
[...]
> But we have to deal with the reality that when you are writing
> multi-threaded software you are going to see side effects of the CPU
> treating the order of your instructions more like a suggestion.
That's true, but the observable behaviour of the application when running on
real hardware must match a permissible observable behaviour of the abstract
machine. If it doesn't, then there's a problem somewhere: either a bug in the
compiler or the runtime, or the behaviour in the abstract machine was
underspecified.
To that effect, the compiler and runtime must insert *some* barriers in some
places. So the questions relevant to this thread are: a) does the Standard
require some barriers around clock now() functions; and b) if so, which ones?
Discussion wrote:
> And as we have discussed those concrete machines don't really respect "order
> of execution", unless you put barriers everywhere, and nobody would want
> that because that would make things painfully slow.
[...]
> But we have to deal with the reality that when you are writing
> multi-threaded software you are going to see side effects of the CPU
> treating the order of your instructions more like a suggestion.
That's true, but the observable behaviour of the application when running on
real hardware must match a permissible observable behaviour of the abstract
machine. If it doesn't, then there's a problem somewhere: either a bug in the
compiler or the runtime, or the behaviour in the abstract machine was
underspecified.
To that effect, the compiler and runtime must insert *some* barriers in some
places. So the questions relevant to this thread are: a) does the Standard
require some barriers around clock now() functions; and b) if so, which ones?
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2026-06-11 17:09:10
