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


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

In Praise of Slacking (Was: Parking is more expensive than spinning)

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.c, comp.theory, comp.lang.c++
Subject In Praise of Slacking (Was: Parking is more expensive than spinning)
Date 2026-08-03 23:56 +0200
Message-ID <114r2pj$tgcs$1@solani.org> (permalink)
References <114ibo4$2q4sk$1@toylet.eternal-september.org> <114r1j1$tfll$2@solani.org> <114r1l2$tfll$3@solani.org> <114r24d$tg0g$1@solani.org>

Cross-posted to 3 groups.

Show all headers | View raw


Hi,

While in 2012 spinning was absolute no go,
reflecting somehow the economic mantra
of rationalization:

“I want to say, in all seriousness, that a
great deal of harm is being done in the
modern world by belief in the virtuousness
of work, and that the road to happiness
and prosperity lies in an organised
diminution of work.”
-- Bertrand Russell, In Praise of Idleness

My work premis on the other hand, is challenging
the root assumption behind the economic mantra,
which is scarce resources. We can see the GPU

as a device that provides a place for slacking
at the workplace, lifting procrastination to
the status of working:

   I'm a spinner, I'm a sinner
   I spin on CAS loops for my dinner
   Some call it busy-wait, I call it fate
   When the queue is empty, I just rotate

Bye

Mild Shock schrieb:
> Hi,
> 
> One core problem in the design of algorithms
> for a large number of cores, such as found in a
> GPU, and in general, is the fact, that parking
> 
> is most often more expensive than spinning.
> So if you have short wait times or few waiters ,
> the cost model looks favorable if you use
> 
> spinning, versus the same thing implemented
> with parking. The Java libraries by Doug Lea found
> in java.concurrency go even that far to use hybrid
> 
> algorithms, that use spinning and parking. I guess
> its pretty easy, you just do backoff by using parking.
> 
> Bye
> 
> Mild Shock schrieb:
>> Hi,
>>
>> The clever soluton by Dmitry Vyukov shows
>> that the monitor is not necessarily canonical, when
>> we allow spinning. But spinning sometimes runs
>>
>> counter to what we expect an operating system
>> respectively a language runtime does with processes
>> and threads, namely they are parked.
>>
>> The absense of parking in GPU can now give the
>> false impression, that spinning is not allowed.
>> But why did Dmitry Vyukov develop his solution,
>>
>> and had a website called 1000 cores? Because
>> with a large number of cores and certain systolic
>> payloads, i.e. always enough work for all threads,
>>
>> the operating systems model of 2000 threads being
>> parked, this requirement can severly be challenged,
>> and allows a fundamental rethinking.
>>
>> Bye
>>
>> Mild Shock schrieb:
>>> Hi,
>>>
>>> Understanding the difference between Queue and Mutex?
>>>
>>> Mutex: A single binary semaphore
>>>
>>> Queue: A condition to signal non empty
>>>         A condition to signal non full
>>>         A monitor for the critical section
>>>
>>> Monitors were invented by Per Brinch Hansen
>>> and C. A. R. Hoare. Although the critical section
>>> could be modelled by a simple mutex,
>>>
>>> The condition wait has to leave the critical
>>> section temporarily, so the conditions sit on
>>> the monitor mutex. So who is the biggest moron?
>>>
>>> Well Chris M. Thomasson, I already talk like
>>> for one month, about the need for bounded queues,
>>> but all he can present recently was some
>>>
>>> C code for a spin backoff mutex?
>>>
>>> Bye
>>>
>>> Mr. Man-wai Chang schrieb:
>>>>
>>>> What is a genius programmer?
>>>>
>>>
>>
> 

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


Thread

What is a genius programmer (e.g. C, Pascal, Foxpro)? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2026-07-31 22:33 +0800
  Re: What is a genius programmer (e.g. C, Pascal, Foxpro)? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-07-31 22:47 +0800
    Re: What is a genius programmer (e.g. C, Pascal, Foxpro)? BGB <cr88192@gmail.com> - 2026-08-04 15:27 -0500
      Re: What is a genius programmer (e.g. C, Pascal, Foxpro)? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-05 05:22 +0800
        Re: What is a genius programmer (e.g. C, Pascal, Foxpro)? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-05 07:24 +0000
  Re: What is a genius programmer (e.g. C, Pascal, Foxpro)? R Kym Horsell <kym@sdf.org> - 2026-07-31 17:09 +0000
  Re: What is a genius programmer (e.g. C, Pascal, Foxpro)? John McCue <jmclnx@gmail.com.invalid> - 2026-08-03 21:15 +0000
  Understanding difference Queue and Mutex? (Was: What is a genius programmer) Mild Shock <janburse@fastmail.fm> - 2026-08-03 23:35 +0200
    What does Dmitry Vyukov teach us? (Was: Understanding difference Queue and Mutex?) Mild Shock <janburse@fastmail.fm> - 2026-08-03 23:36 +0200
      Parking is more expensive than spinning (Re: What does Dmitry Vyukov teach us?) Mild Shock <janburse@fastmail.fm> - 2026-08-03 23:44 +0200
        In Praise of Slacking (Was: Parking is more expensive than spinning) Mild Shock <janburse@fastmail.fm> - 2026-08-03 23:56 +0200
          Re: In Praise of Slacking (Was: Parking is more expensive than spinning) Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-04 08:29 +0800
            You should write a blog about it [(Was: In Praise of Slacking) Mild Shock <janburse@fastmail.fm> - 2026-08-04 02:49 +0200
              Re: You should write a blog about it [(Was: In Praise of Slacking) Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-04 09:47 +0800

csiph-web