Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #118549

Re: Idea for spin-wait loops

From Michael S <already5chosen@yahoo.com>
Newsgroups comp.lang.c++
Subject Re: Idea for spin-wait loops
Date 2024-03-25 14:34 +0200
Organization A noiseless patient Spider
Message-ID <20240325153450.000019cf@yahoo.com> (permalink)
References <utn1eh$3oeks$1@raubtier-asyl.eternal-september.org> <utnff2$3rn1f$1@dont-email.me> <Zf0MN.450378$yEgf.411259@fx09.iad>

Show all headers | View raw


On Sun, 24 Mar 2024 20:43:37 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
> >On 3/23/2024 9:53 AM, Bonita Montero wrote:  
> >> I've got a nice idea for a new processor-extrension for spin-wait
> >> -loops. The idea is that a thread of a processors enters a sleep
> >> state if a word in memory is equal to a certain register until  
> 
> A processor which is doesn't own (or have a shared copy) of the
> cacheline which would contain that word in memory will never know
> if it was modified, as it won't see the invalidate messages in
> a directory-based cache subsystem (leaving aside noncachable
> accesses to the word in memory, of course).
> 

It seems, I didn't understand the idea.
Of course, the waiting thread/core has the word in question in its
L1D cache when it enters the wait loop. 
Of course, it is awaken if/when the the word is evicted from the cache
for unrelated reason, i.e. practically because of capacity conflict
caused by activity of other threads that are running on the same
core. There is nothing wrong with spurious awakenings as long as they
are rare.

> This sounds like a solution to a problem that doesn't exist,
> and there would be no incentive for a processor designer
> to include the substantial additional complexity required
> to support your feature.

The problem does exist and primitive proposed by Bonita is not new. It
is a minor modification of Monitor/Mwait.
For current Intel and AMD processors this sort of things is
relatively unattractive because at 2 threads per core and with rather
measurable throughput gains achieved by running 2 threads instead of
one (for AMD up to 30%, for Intel a little less, but often measurable),
each thread is a valuable resource, so you don't really want to keep it
paused for too long time. And the whole point of Bonita's amendment of
existing mechanism is that the software has more control on long waits.

On IBM POWER and on few of Sun/Oracle chips they have up to 8 threads
per core, so each thread is not that valuable. It means that longer
uninterrupted wait has more sense and control of duration of the
timeout is more desirable. But may be IBM's and Oracle's variants of
MWAIT already have it?



Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-23 17:53 +0100
  Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-23 13:52 -0700
    Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-23 13:58 -0700
      Re: Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-24 07:38 +0100
        Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-25 19:48 -0700
          Re: Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-26 11:12 +0100
            Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-26 13:02 -0700
              Re: Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-26 21:23 +0100
                Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-26 13:30 -0700
                Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-26 13:31 -0700
                Re: Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-27 10:18 +0100
              Re: Idea for spin-wait loops Michael S <already5chosen@yahoo.com> - 2024-03-27 17:09 +0200
                Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-27 12:58 -0700
    Re: Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-24 07:37 +0100
      Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-24 12:33 -0700
    Re: Idea for spin-wait loops scott@slp53.sl.home (Scott Lurndal) - 2024-03-24 20:43 +0000
      Re: Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-25 07:23 +0100
      Re: Idea for spin-wait loops Michael S <already5chosen@yahoo.com> - 2024-03-25 14:34 +0200
        Re: Idea for spin-wait loops Michael S <already5chosen@yahoo.com> - 2024-03-25 19:11 +0200
        Re: Idea for spin-wait loops Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-25 18:53 +0100
          Re: Idea for spin-wait loops "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-26 13:13 -0700

csiph-web