C++ Logo


Advanced search

Re: Fwd: Synchronization of atomic notify and wait

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 20 Jul 2022 21:24:47 -0700
On Wednesday, 20 July 2022 16:29:01 PDT you wrote:
> On Thu, Jul 21, 2022 at 1:21 AM Thiago Macieira via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
> > It actually limits to anything short of "forever", but "a century" is
> > allowed.
> It's strange that a rule would forbid something "taking forever", but
> allow any arbitrarily large duration. The rule seems to lack any bite.

What would you put the limit at? A second? That's probably too short in a
massively multi-process multi-core system. A minute? What happens if the
atomic operation in question is actually implemented by multiple instructions
and the OS scheduler schedules the thread out between the start and the end of
that operation?

The point is that it must happen eventually on its own, without the programmer
having to take action. But how long that takes is entirely indeterminate. The
moment that you write multithreaded code, you can no longer prove it will
finish; you can at best prove it has a very good likelihood of doing so.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2022-07-21 04:24:49