• Understanding difference Queue and Mutex? (Was: What is a genius progra

    From Mild Shock@3:633/10 to All on Mon Aug 3 23:35:29 2026
    Subject: Understanding difference Queue and Mutex? (Was: What is a genius programmer)

    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?



    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mild Shock@3:633/10 to All on Mon Aug 3 23:36:34 2026
    Subject: What does Dmitry Vyukov teach us? (Was: Understanding difference Queue and Mutex?)

    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?




    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mild Shock@3:633/10 to All on Mon Aug 3 23:44:46 2026
    Subject: Parking is more expensive than spinning (Re: What does Dmitry Vyukov teach us?)

    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?





    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mild Shock@3:633/10 to All on Mon Aug 3 23:56:03 2026
    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?






    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Tue Aug 4 08:29:28 2026
    Subject: Re: In Praise of Slacking (Was: Parking is more expensive than spinning)

    On 04/08/2026 5:56 AM, Mild Shock wrote:
    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


    I found some old code recently that used

    #include <stdlib.h>
    #pragma intrinsic ( _rotl )
    #define rotl32( x, c ) _rotl( x, c )

    with the comment that this intrinsic is not documented as such on the
    Microsoft website. I hope this tidbit is of use to someone who wants
    to implement bit rotation as a single instruction. I have not tested
    this on VS 2026 yet, so please let me know if this doesn't work for
    your use case.


    Best wishes, and happy rotation!
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Mild Shock@3:633/10 to All on Tue Aug 4 02:49:51 2026
    Hi,

    You should write a blog about it. Could
    give new live to the blog in your footer.
    The blog has also seen better times,

    the last post was July 20, 2020. And then?
    The big reset? All brain cells gone?

    Bye

    Johann 'Myrkraverk' Oskarsson schrieb:
    When the queue is empty, I just rotate

    I have not tested this on VS 2026 yet,˙ so
    please let me know if this˙ doesn't work for
    your use case.

    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Tue Aug 4 09:47:12 2026
    On 04/08/2026 8:49 AM, Mild Shock wrote:
    Hi,

    You should write a blog about it. Could
    give new live to the blog in your footer.
    The blog has also seen better times,

    the last post was July 20, 2020. And then?
    The big reset? All brain cells gone?

    Life happened. Thanks for caring. I did micro-blog with WordPerfect
    for DOS on a different website for a bit, but haven't picked that up
    either. Blogging is not a priority now. I'm picking up coding again
    after an extended break. By that I mean my own projects. My next job
    is also on hold for a few more months. They know how to reach me if
    they need me in a hurry.

    And my braincells are functioning even better than in 2020.

    And on that subject, is there a better blogging platform than Word-
    Perfect for DOS? I used to write the blog entries in WPDOS, then
    open with WPwin2021 and export to HTML. That works fine for some
    workflows, but does get cumbersome after a while.

    All the open source blogging platforms seem geared towards SEO and monetization, which isn't a priority for me, with my personal blog.
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)