Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

This system will self-destruct in five minutes.


devel / comp.lang.c++ / Re: A Java- / .NET-like monitor

SubjectAuthor
* A Java- / .NET-like monitorBonita Montero
+* Re: A Java- / .NET-like monitorBonita Montero
|`* Re: A Java- / .NET-like monitorChris M. Thomasson
| +* Re: A Java- / .NET-like monitorChris M. Thomasson
| |+* Re: A Java- / .NET-like monitorBonita Montero
| ||`- Re: A Java- / .NET-like monitorChris M. Thomasson
| |`- Re: A Java- / .NET-like monitorChris M. Thomasson
| `* Re: A Java- / .NET-like monitorBonita Montero
|  `- Re: A Java- / .NET-like monitorChris M. Thomasson
+* Re: A Java- / .NET-like monitorKaz Kylheku
|`* Re: A Java- / .NET-like monitorBonita Montero
| `* Re: A Java- / .NET-like monitorKaz Kylheku
|  `* Re: A Java- / .NET-like monitorBonita Montero
|   +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   |`* Re: A Java- / .NET-like monitorKaz Kylheku
|   | `- Re: A Java- / .NET-like monitorChris M. Thomasson
|   +* Re: A Java- / .NET-like monitorKaz Kylheku
|   |`* Re: A Java- / .NET-like monitorBonita Montero
|   | +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |`* Re: A Java- / .NET-like monitorBonita Montero
|   | | `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |+- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   | `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |+- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   | `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |  +- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |   `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |`* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    | `- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    +* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |`* Re: A Java- / .NET-like monitorPavel
|   | |   |   |    | `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |  `* Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |   `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |    `* Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |     +- Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     +* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     |+* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     ||+- Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||+- Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |     ||`* Re: A Java- / .NET-like monitorMichael S
|   | |   |   |    |     || `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||   `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||    +- Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||    `* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||     `* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     ||      +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |`* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      | +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      | |`- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      | `* Re: A Java- / .NET-like monitorFred. Zwarts
|   | |   |   |    |     ||      |  `* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      |   `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    `- Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      +* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |`* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     ||      | `* Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      |  +- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |  `* Re: A Java- / .NET-like monitorMichael S
|   | |   |   |    |     ||      |   +- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |   `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    +* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    |+* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    || `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||  +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |    ||  |`- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |    ||  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    ||   `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||    `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    ||     `* Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      |    ||      `- Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     ||      |    |`- Re: A Java- / .NET-like monitorScott Lurndal
|   | |   |   |    |     ||      |    `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     ||      |     `- Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     ||      `- Re: A Java- / .NET-like monitorDavid Brown
|   | |   |   |    |     |+- Re: A Java- / .NET-like monitorPavel
|   | |   |   |    |     |`* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     | `* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     |  `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |   `* Re: A Java- / .NET-like monitorKaz Kylheku
|   | |   |   |    |     |    `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |     `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |      +* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |      |`- Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |      `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |       `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |        `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |         `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |          `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     |           `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    |     |            `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   |    |     `* Re: A Java- / .NET-like monitorChris M. Thomasson
|   | |   |   |    `* Re: A Java- / .NET-like monitorBonita Montero
|   | |   |   `- Re: A Java- / .NET-like monitorBonita Montero
|   | |   `* Re: A Java- / .NET-like monitorPavel
|   | `* Re: A Java- / .NET-like monitorKaz Kylheku
|   `* Re: A Java- / .NET-like monitorChris M. Thomasson
+* Re: A Java- / .NET-like monitorBonita Montero
`* Re: A Java- / .NET-like monitorBonita Montero

Pages:1234567891011
Re: A Java- / .NET-like monitor

<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2552&group=comp.lang.c%2B%2B#2552

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 06:45:40 +0100
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 05:45:38 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2181902"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Q6I7+ixHDcDO+9iooQltNsmdvNfQSdzA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:1p+L8sFYFiEoC6LWtOEusy8TJSg=
In-Reply-To: <uihrj7$228mv$16@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Thu, 9 Nov 2023 05:45 UTC

Am 09.11.2023 um 06:44 schrieb Chris M. Thomasson:

> Wait morphing is not in the realm of the compiler. It's in the kernel.

Read this:
https://stackoverflow.com/questions/45163701/which-os-platforms-implement-wait-morphing-optimization

Re: A Java- / .NET-like monitor

<uihrqr$228mv$19@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2553&group=comp.lang.c%2B%2B#2553

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Wed, 8 Nov 2023 21:48:11 -0800
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <uihrqr$228mv$19@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 05:48:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2171615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5n5wN4vJv/EChb3ad+3g4HEe4dyHNaxU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:mpHR0H9pPtjWys66vk3VVDlb86o=
In-Reply-To: <uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 9 Nov 2023 05:48 UTC

On 11/8/2023 9:45 PM, Bonita Montero wrote:
> Am 09.11.2023 um 06:44 schrieb Chris M. Thomasson:
>
>> Wait morphing is not in the realm of the compiler. It's in the kernel.
>
> Read this:
> https://stackoverflow.com/questions/45163701/which-os-platforms-implement-wait-morphing-optimization

Wait morphing can be highly beneficial.

Re: A Java- / .NET-like monitor

<uihruu$228mv$20@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2554&group=comp.lang.c%2B%2B#2554

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Wed, 8 Nov 2023 21:50:22 -0800
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <uihruu$228mv$20@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 05:50:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2171615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/57IO8LIyYL5HWQNY6qJMwCl27X1xUaio="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/YV6DtV3f9n6Kv7eFK+2gs6xfTw=
Content-Language: en-US
In-Reply-To: <uihrqr$228mv$19@dont-email.me>
 by: Chris M. Thomasson - Thu, 9 Nov 2023 05:50 UTC

On 11/8/2023 9:48 PM, Chris M. Thomasson wrote:
> On 11/8/2023 9:45 PM, Bonita Montero wrote:
>> Am 09.11.2023 um 06:44 schrieb Chris M. Thomasson:
>>
>>> Wait morphing is not in the realm of the compiler. It's in the kernel.
>>
>> Read this:
>> https://stackoverflow.com/questions/45163701/which-os-platforms-implement-wait-morphing-optimization
>
> Wait morphing can be highly beneficial.

I have to go to work on my fractals right now, will get back to you. I
will mostly have time to port your code into a Relacy unit test sometime
later on tonight or tomorrow. This work will be for free for you. Will
you even appreciate it in any way shape or form? Or mock me?

Re: A Java- / .NET-like monitor

<uihs01$22jil$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2555&group=comp.lang.c%2B%2B#2555

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 06:50:58 +0100
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <uihs01$22jil$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 05:50:57 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2182741"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18v+ddcMlz7qFvbXr1usEuJ8o0Q3QFz3Z8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Z7kde/BFwU6g/gKjkuJ1+v1PLQI=
Content-Language: de-DE
In-Reply-To: <uihram$22gqs$1@raubtier-asyl.eternal-september.org>
 by: Bonita Montero - Thu, 9 Nov 2023 05:50 UTC

Am 09.11.2023 um 06:39 schrieb Bonita Montero:
> Am 09.11.2023 um 06:35 schrieb Chris M. Thomasson:
>
>> Wait morphing is a way that shows how interconnected a mutex actually
>> is with a condition variable...
>
> As you can derive from what I said I know what wait morphing is.
> I think wait morphing could be prevented unter systems supporting
> SysV seamphores by allocating a semaphore set of two semaphores
> for each mutex and leaving the second unused until you have a
> condition variable.
>

Sorry, this dosn't work beyond one condvar per mutex.

Re: A Java- / .NET-like monitor

<uihs34$22jil$2@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2556&group=comp.lang.c%2B%2B#2556

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.niel.me!nntp.terraraq.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 06:52:37 +0100
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uihs34$22jil$2@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 05:52:36 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2182741"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1870C17WQDRxM5vvMcqR8H7eVzz2tCw/cg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:3fFdVQyVqzdAkqOtckOQ03IXK7s=
Content-Language: de-DE
In-Reply-To: <uihrqr$228mv$19@dont-email.me>
 by: Bonita Montero - Thu, 9 Nov 2023 05:52 UTC

Am 09.11.2023 um 06:48 schrieb Chris M. Thomasson:
> On 11/8/2023 9:45 PM, Bonita Montero wrote:
>> Am 09.11.2023 um 06:44 schrieb Chris M. Thomasson:
>>
>>> Wait morphing is not in the realm of the compiler. It's in the kernel.
>>
>> Read this:
>> https://stackoverflow.com/questions/45163701/which-os-platforms-implement-wait-morphing-optimization
>
> Wait morphing can be highly beneficial.

Wait morphing isn't necessary under Win32 since you can wait
for the mutexe's binary semaphore and for the condvar's counting
semaphore in one step with WaitForMultipleObjects. Unfortunately
there's nothing under Linux like that.

Re: A Java- / .NET-like monitor

<uihsdn$228mv$21@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2557&group=comp.lang.c%2B%2B#2557

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Wed, 8 Nov 2023 21:58:14 -0800
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <uihsdn$228mv$21@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me> <uihruu$228mv$20@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 05:58:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2171615"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/op05OkJvvf0GKG9enVu3eV9I1j6X5OLU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:gjZnHtQ+Ca2mJ8b8R0U5K8e4Hnc=
In-Reply-To: <uihruu$228mv$20@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 9 Nov 2023 05:58 UTC

On 11/8/2023 9:50 PM, Chris M. Thomasson wrote:
> On 11/8/2023 9:48 PM, Chris M. Thomasson wrote:
>> On 11/8/2023 9:45 PM, Bonita Montero wrote:
>>> Am 09.11.2023 um 06:44 schrieb Chris M. Thomasson:
>>>
>>>> Wait morphing is not in the realm of the compiler. It's in the kernel.
>>>
>>> Read this:
>>> https://stackoverflow.com/questions/45163701/which-os-platforms-implement-wait-morphing-optimization
>>
>> Wait morphing can be highly beneficial.
>
> I have to go to work on my fractals right now, will get back to you. I
> will mostly have time to port your code into a Relacy unit test sometime
> later on tonight or tomorrow. This work will be for free for you. Will
> you even appreciate it in any way shape or form? Or mock me?

the funny thing is that I need to model one of my new wait-free queue
experiments in Relacy for use in my rendering engine.

Re: A Java- / .NET-like monitor

<uihudf$230h4$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2558&group=comp.lang.c%2B%2B#2558

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!nntp.comgw.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 07:32:16 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uihudf$230h4$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<uih5r1$1rd03$1@dont-email.me>
<uihnhu$21tq7$2@raubtier-asyl.eternal-september.org>
<uihq1s$228mv$3@dont-email.me>
<uihqac$22aps$2@raubtier-asyl.eternal-september.org>
<uihqkv$228mv$7@dont-email.me>
<uihqo7$22dbg$1@raubtier-asyl.eternal-september.org>
<uihqqq$228mv$9@dont-email.me>
<uihr10$22fdu$1@raubtier-asyl.eternal-september.org>
<uihr5j$228mv$12@dont-email.me>
<uihrd3$22gqs$2@raubtier-asyl.eternal-september.org>
<uihrfi$228mv$15@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 06:32:15 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2196004"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Emz75biW0Fp23cdalOchwcuJc1y0CDlc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:BvQptXFpCTEXZkCiGFnC3QFmGJY=
In-Reply-To: <uihrfi$228mv$15@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Thu, 9 Nov 2023 06:32 UTC

Am 09.11.2023 um 06:42 schrieb Chris M. Thomasson:

> On 11/8/2023 9:40 PM, Bonita Montero wrote:

>> My code is understandable if you know MT-primitives
>> and SysV-IPC. There's nothing "damn" with my code.

> Oh well, like I said, you seem to be a fun person to work with...

If you were here we would go through the code together
and you would immediately understand it.

Re: A Java- / .NET-like monitor

<uihv92$234cs$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2559&group=comp.lang.c%2B%2B#2559

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Wed, 8 Nov 2023 22:46:58 -0800
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uihv92$234cs$1@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me> <uihruu$228mv$20@dont-email.me>
<uihsdn$228mv$21@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 06:46:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2199964"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++2RZUcjsTEw6xhDW1VBnNDoVsDrLQTe0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:LGyvQn4mp4QZ2ibrrNGo1HBrI7w=
Content-Language: en-US
In-Reply-To: <uihsdn$228mv$21@dont-email.me>
 by: Chris M. Thomasson - Thu, 9 Nov 2023 06:46 UTC

On 11/8/2023 9:58 PM, Chris M. Thomasson wrote:
> On 11/8/2023 9:50 PM, Chris M. Thomasson wrote:
>> On 11/8/2023 9:48 PM, Chris M. Thomasson wrote:
>>> On 11/8/2023 9:45 PM, Bonita Montero wrote:
>>>> Am 09.11.2023 um 06:44 schrieb Chris M. Thomasson:
>>>>
>>>>> Wait morphing is not in the realm of the compiler. It's in the kernel.
>>>>
>>>> Read this:
>>>> https://stackoverflow.com/questions/45163701/which-os-platforms-implement-wait-morphing-optimization
>>>
>>> Wait morphing can be highly beneficial.
>>
>> I have to go to work on my fractals right now, will get back to you. I
>> will mostly have time to port your code into a Relacy unit test
>> sometime later on tonight or tomorrow. This work will be for free for
>> you. Will you even appreciate it in any way shape or form? Or mock me?
>
> the funny thing is that I need to model one of my new wait-free queue
> experiments in Relacy for use in my rendering engine.

An example of my main experiment:

https://youtu.be/n13GHyYEfLA

All of my own GLSL shaders, pure C++ and openGL.

Re: A Java- / .NET-like monitor

<uihvmj$2351m$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2560&group=comp.lang.c%2B%2B#2560

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Wed, 8 Nov 2023 22:54:11 -0800
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uihvmj$2351m$2@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<uih5r1$1rd03$1@dont-email.me>
<uihnhu$21tq7$2@raubtier-asyl.eternal-september.org>
<uihq1s$228mv$3@dont-email.me>
<uihqac$22aps$2@raubtier-asyl.eternal-september.org>
<uihqkv$228mv$7@dont-email.me>
<uihqo7$22dbg$1@raubtier-asyl.eternal-september.org>
<uihqqq$228mv$9@dont-email.me>
<uihr10$22fdu$1@raubtier-asyl.eternal-september.org>
<uihr5j$228mv$12@dont-email.me>
<uihrd3$22gqs$2@raubtier-asyl.eternal-september.org>
<uihrfi$228mv$15@dont-email.me>
<uihudf$230h4$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 06:54:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2200630"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BL14hpognQLPXrUUp6zMu63tfLxJmmqQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XaTkGHm5aJmBCjewkHoiIQ8WSA8=
In-Reply-To: <uihudf$230h4$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 9 Nov 2023 06:54 UTC

On 11/8/2023 10:32 PM, Bonita Montero wrote:
> Am 09.11.2023 um 06:42 schrieb Chris M. Thomasson:
>
>> On 11/8/2023 9:40 PM, Bonita Montero wrote:
>
>>> My code is understandable if you know MT-primitives
>>> and SysV-IPC. There's nothing "damn" with my code.
>
>> Oh well, like I said, you seem to be a fun person to work with...
>
> If you were here we would go through the code together
> and you would immediately understand it.
>

Since I have to model one of my experimental algorithms in Relacy
anyway, well, I will be right up in it. Wrt my code, well, its trying to
make some fractals go volumetric and I need to highly efficient and
specialized LIFO/FIFO stack/queue system for it. They are running on the
CPU, I might even be able to get it run in shaders, but for now, I need
to work on modeling my sketch of my code in Relacy, create some test
units, and give it a go. Fwiw, here is one of my vector fields:

https://youtu.be/poXeq5V0dso

This used an older queue of mine to help distribute the field processing
across multiple processors.

Re: A Java- / .NET-like monitor

<uii03m$2351m$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2561&group=comp.lang.c%2B%2B#2561

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Wed, 8 Nov 2023 23:01:10 -0800
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <uii03m$2351m$3@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<uih5r1$1rd03$1@dont-email.me>
<uihnhu$21tq7$2@raubtier-asyl.eternal-september.org>
<uihq1s$228mv$3@dont-email.me>
<uihqac$22aps$2@raubtier-asyl.eternal-september.org>
<uihqkv$228mv$7@dont-email.me>
<uihqo7$22dbg$1@raubtier-asyl.eternal-september.org>
<uihqqq$228mv$9@dont-email.me>
<uihr10$22fdu$1@raubtier-asyl.eternal-september.org>
<uihr5j$228mv$12@dont-email.me>
<uihrd3$22gqs$2@raubtier-asyl.eternal-september.org>
<uihrfi$228mv$15@dont-email.me>
<uihudf$230h4$1@raubtier-asyl.eternal-september.org>
<uihvmj$2351m$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 07:01:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2200630"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GsO4Gv/hzIvVkrPVX/iyYHkXQMUDvdW0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:PLa44IQvT6HEIczKENgpvcWLFww=
Content-Language: en-US
In-Reply-To: <uihvmj$2351m$2@dont-email.me>
 by: Chris M. Thomasson - Thu, 9 Nov 2023 07:01 UTC

On 11/8/2023 10:54 PM, Chris M. Thomasson wrote:
> On 11/8/2023 10:32 PM, Bonita Montero wrote:
>> Am 09.11.2023 um 06:42 schrieb Chris M. Thomasson:
>>
>>> On 11/8/2023 9:40 PM, Bonita Montero wrote:
>>
>>>> My code is understandable if you know MT-primitives
>>>> and SysV-IPC. There's nothing "damn" with my code.
>>
>>> Oh well, like I said, you seem to be a fun person to work with...
>>
>> If you were here we would go through the code together
>> and you would immediately understand it.
>>
>
> Since I have to model one of my experimental algorithms in Relacy
> anyway, well, I will be right up in it. Wrt my code, well, its trying to
> make some fractals go volumetric and I need to highly efficient and
> specialized LIFO/FIFO stack/queue system for it. They are running on the
> CPU, I might even be able to get it run in shaders, but for now, I need
> to work on modeling my sketch of my code in Relacy, create some test
> units, and give it a go. Fwiw, here is one of my vector fields:
>
> https://youtu.be/poXeq5V0dso
>
> This used an older queue of mine to help distribute the field processing
> across multiple processors.

Fwiw, this one is basically embarrassingly parallel to create each
frame. Well, that is kind of cheating wrt embarrassingly parallel, but,
oh well:

https://youtu.be/DrPp6xfLe4Q

This one is from a recursive algorithm of mine, not too efficient wrt
the generation part that gives me my field points to work with. It takes
a while to render an animation in 4k. The recursive nature of it can
blow a threads stack if I get too detailed. So, I need to refine my
current quick and dirty proof of concept code, so to speak. It is kind
of embarrassingly parallel...

Re: A Java- / .NET-like monitor

<uii048$238id$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2562&group=comp.lang.c%2B%2B#2562

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 08:01:29 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <uii048$238id$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 07:01:28 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2204237"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kbuBhYSoVyH4ljfLQet23WL4nLjI5vvw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cGY1G3EQJ0cs7IhIwDEz+DJ9x/I=
Content-Language: de-DE
In-Reply-To: <uihrqr$228mv$19@dont-email.me>
 by: Bonita Montero - Thu, 9 Nov 2023 07:01 UTC

Am 09.11.2023 um 06:48 schrieb Chris M. Thomasson:

> Wait morphing can be highly beneficial.

I just checkes how many voluntary context switches I have under Linux
when having a poing-pong between two theads serving a common mutex and
individual condvars.

#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <sys/resource.h>

using namespace std;

int main()
{ mutex mtx;
struct wait_t
{
bool signal;
condition_variable cond;
} waitA, waitB;
constexpr size_t ROUNDS = 100'000;
atomic<uint64_t> switches( 0 );
auto thr = [&]( wait_t &waitMe, wait_t &waitYou )
{
for( size_t r = ROUNDS; r--; )
{
unique_lock<mutex> lock( mtx );
while( !waitMe.signal )
waitMe.cond.wait( lock );
waitMe.signal = false;
waitYou.signal = true;
waitYou.cond.notify_one();
}
rusage ru;
if( getrusage( RUSAGE_THREAD, &ru ) )
terminate();
switches += ru.ru_nvcsw;
};
waitA.signal = true;
waitA.cond.notify_one();
jthread
thrA( thr, ref( waitA ), ref( waitB ) ),
thrB( thr, ref( waitB ), ref( waitA ) );
thrA.join();
thrB.join();
cout << switches << endl;
}

The code prints about ROUNDS * context switches, that's great.

Re: A Java- / .NET-like monitor

<uii052$238id$2@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2563&group=comp.lang.c%2B%2B#2563

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 08:01:55 +0100
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <uii052$238id$2@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<20231108152102.495@kylheku.com>
<uihnei$21tq7$1@raubtier-asyl.eternal-september.org>
<uihnkd$21rae$1@dont-email.me>
<uihnnm$21tq7$5@raubtier-asyl.eternal-september.org>
<uihnup$21rab$4@dont-email.me>
<uihpgl$227kv$1@raubtier-asyl.eternal-september.org>
<uihpmf$228mv$1@dont-email.me>
<uihq1g$2290l$1@raubtier-asyl.eternal-september.org>
<uihr3u$228mv$11@dont-email.me>
<uihram$22gqs$1@raubtier-asyl.eternal-september.org>
<uihrd6$228mv$13@dont-email.me>
<uihrg6$22hup$1@raubtier-asyl.eternal-september.org>
<uihrj7$228mv$16@dont-email.me>
<uihrm2$22ioe$1@raubtier-asyl.eternal-september.org>
<uihrqr$228mv$19@dont-email.me>
<uii048$238id$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 9 Nov 2023 07:01:54 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2204237"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18s+ysjzPnRwtRxyIKCbxrTt6hTmSnD2BQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:JfffRWOspgCwh1GbPo91b/ayXu0=
In-Reply-To: <uii048$238id$1@raubtier-asyl.eternal-september.org>
Content-Language: de-DE
 by: Bonita Montero - Thu, 9 Nov 2023 07:01 UTC

Am 09.11.2023 um 08:01 schrieb Bonita Montero:
> Am 09.11.2023 um 06:48 schrieb Chris M. Thomasson:
>
>> Wait morphing can be highly beneficial.
>
>
> I just checkes how many voluntary context switches I have under Linux
> when having a poing-pong between two theads serving a common mutex and
> individual condvars.
>
> #include <iostream>
> #include <thread>
> #include <mutex>
> #include <condition_variable>
> #include <atomic>
> #include <sys/resource.h>
>
> using namespace std;
>
> int main()
> {
>     mutex mtx;
>     struct wait_t
>     {
>         bool signal;
>         condition_variable cond;
>     } waitA, waitB;
>     constexpr size_t ROUNDS = 100'000;
>     atomic<uint64_t> switches( 0 );
>     auto thr = [&]( wait_t &waitMe, wait_t &waitYou )
>     {
>         for( size_t r = ROUNDS; r--; )
>         {
>             unique_lock<mutex> lock( mtx );
>             while( !waitMe.signal )
>                 waitMe.cond.wait( lock );
>             waitMe.signal = false;
>             waitYou.signal = true;
>             waitYou.cond.notify_one();
>         }
>         rusage ru;
>         if( getrusage( RUSAGE_THREAD, &ru ) )
>             terminate();
>         switches += ru.ru_nvcsw;
>     };
>     waitA.signal = true;
>     waitA.cond.notify_one();
>     jthread
>         thrA( thr, ref( waitA ), ref( waitB ) ),
>         thrB( thr, ref( waitB ), ref( waitA ) );
>     thrA.join();
>     thrB.join();
>     cout << switches << endl;
> }
>
> The code prints about ROUNDS * context switches, that's great.
* 2

Re: A Java- / .NET-like monitor

<uii07j$2351m$4@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2564&group=comp.lang.c%2B%2B#2564

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Wed, 8 Nov 2023 23:03:15 -0800
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <uii07j$2351m$4@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<20231108100351.347@kylheku.com>
<uigk5o$1nmku$1@raubtier-asyl.eternal-september.org>
<20231108114723.256@kylheku.com>
<uigp4n$1onpc$1@raubtier-asyl.eternal-september.org>
<uih5r1$1rd03$1@dont-email.me>
<uihnhu$21tq7$2@raubtier-asyl.eternal-september.org>
<uihq1s$228mv$3@dont-email.me>
<uihqac$22aps$2@raubtier-asyl.eternal-september.org>
<uihqkv$228mv$7@dont-email.me>
<uihqo7$22dbg$1@raubtier-asyl.eternal-september.org>
<uihqqq$228mv$9@dont-email.me>
<uihr10$22fdu$1@raubtier-asyl.eternal-september.org>
<uihr5j$228mv$12@dont-email.me>
<uihrd3$22gqs$2@raubtier-asyl.eternal-september.org>
<uihrfi$228mv$15@dont-email.me>
<uihudf$230h4$1@raubtier-asyl.eternal-september.org>
<uihvmj$2351m$2@dont-email.me> <uii03m$2351m$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 07:03:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2200630"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kallJZssaPjw8+vwVdTj9gLS+TMuCcuQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:bfy/YphBoQgE/LmR2cZ8VdiBl68=
In-Reply-To: <uii03m$2351m$3@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 9 Nov 2023 07:03 UTC

On 11/8/2023 11:01 PM, Chris M. Thomasson wrote:
> On 11/8/2023 10:54 PM, Chris M. Thomasson wrote:
>> On 11/8/2023 10:32 PM, Bonita Montero wrote:
>>> Am 09.11.2023 um 06:42 schrieb Chris M. Thomasson:
>>>
>>>> On 11/8/2023 9:40 PM, Bonita Montero wrote:
>>>
>>>>> My code is understandable if you know MT-primitives
>>>>> and SysV-IPC. There's nothing "damn" with my code.
>>>
>>>> Oh well, like I said, you seem to be a fun person to work with...
>>>
>>> If you were here we would go through the code together
>>> and you would immediately understand it.
>>>
>>
>> Since I have to model one of my experimental algorithms in Relacy
>> anyway, well, I will be right up in it. Wrt my code, well, its trying
>> to make some fractals go volumetric and I need to highly efficient and
>> specialized LIFO/FIFO stack/queue system for it. They are running on
>> the CPU, I might even be able to get it run in shaders, but for now, I
>> need to work on modeling my sketch of my code in Relacy, create some
>> test units, and give it a go. Fwiw, here is one of my vector fields:
>>
>> https://youtu.be/poXeq5V0dso
>>
>> This used an older queue of mine to help distribute the field
>> processing across multiple processors.
>
> Fwiw, this one is basically embarrassingly parallel to create each
> frame. Well, that is kind of cheating wrt embarrassingly parallel, but,
> oh well:
>
> https://youtu.be/DrPp6xfLe4Q
>
> This one is from a recursive algorithm of mine, not too efficient wrt
> the generation part that gives me my field points to work with. It takes
> a while to render an animation in 4k. The recursive nature of it can
> blow a threads stack if I get too detailed. So, I need to refine my
> current quick and dirty proof of concept code, so to speak. It is kind
> of embarrassingly parallel...

oh shit, I forgot the damn link:

https://youtu.be/YsAkm0VlCsw
(should be 4k, damn it!)

Also, this one is ripe for for improvement. I just know that my new
queue system is going to work for it wrt generating its frames.

https://youtu.be/HwIkk9zENcg

Will create another thread to continue this.

Re: A Java- / .NET-like monitor

<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2570&group=comp.lang.c%2B%2B#2570

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!paganini.bofh.team!newsfeed.xs3.de!callisto.xs3.de!gandalf.srv.welterde.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 10:07:54 +0100
Organization: A noiseless patient Spider
Lines: 92
Message-ID: <uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 09:07:53 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2244280"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192mx6+2QEPktyRr2jIgsTg23LGO+/ZSzU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ow2xhzRJEUqwom0p7d9v38nEE6o=
In-Reply-To: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
Content-Language: de-DE
 by: Bonita Montero - Thu, 9 Nov 2023 09:07 UTC

I did a test of my monitor against two mutexes and two condition
variables, playing pingpong with each other. On Windows my imple-
mentation is about 12 times faster than the mentioned mutex with
condvar on a AMD 7950X Zen4 16 core system. Under WSL2 on the
same machine the Linux implementation is 12% faster than my code.
On Linux bare metal with a Zen2 3990X 64 core system my code is
about 8.5% faster.
As I recently found in this that a wait() incurs only one context
switch back and forth I thought my code woudln't be faster, but
on bare metal it actually is faster. And I was really surprised
that the MS condvar implementation is that extremely slow compared
to my monitor.

#include <iostream>
#include <thread>
#include <chrono>
#include <vector>
#include <mutex>
#include <condition_variable>
#include "monitor.h"

using namespace std;
using namespace chrono;

int main( int argc, char **argv )
{ atomic_int32_t tSum;
auto time = [&]( auto fn )
{
tSum = 0;
auto start = high_resolution_clock::now();
fn();
tSum += (int64_t)duration_cast<nanoseconds>(
high_resolution_clock::now() - start ).count();
};
constexpr size_t ROUNDS = 100'000;
struct not_t
{
monitor mon;
bool notifiy;
} notA { {}, true }, notB { {}, false };
notA.notifiy = true;
auto monThr = [&]( not_t &me, not_t &you )
{
time( [&]()
{
for( size_t r = ROUNDS; r; --r )
{
me.mon.lock();
for( ; !me.notifiy; me.mon.wait() );
me.notifiy = false;
me.mon.unlock();
you.mon.lock();
you.notifiy = true;
you.mon.notify();
you.mon.unlock();
}
} );
};
vector<jthread> threads;
threads.reserve( 0 );
threads.emplace_back( monThr, ref( notA ), ref( notB ) ),
threads.emplace_back( monThr, ref( notB ), ref( notA ) );
threads.resize( 0 );
cout << tSum / ((double)ROUNDS * 2) << endl;
struct cv_t
{
mutex mtx;
condition_variable cv;
bool signal;
} cvA = { {}, {}, true }, cvB = { {}, {}, false };
auto cvThr = [&]( cv_t &cvMe, cv_t &cvYou )
{
time( [&]()
{
for( size_t r = ROUNDS; r; --r )
{
unique_lock<mutex> lockMe( cvMe.mtx );
for( ; !cvMe.signal; cvMe.cv.wait( lockMe ) );
cvMe.signal = false;
lockMe.unlock();
unique_lock<mutex> lockYou( cvYou.mtx );
cvYou.signal = true;
cvYou.cv.notify_one();
}
} );
};
threads.emplace_back( cvThr, ref( cvA ), ref( cvB ) );
threads.emplace_back( cvThr, ref( cvB ), ref( cvA ) );
threads.resize( 0 );
cout << tSum / ((double)ROUNDS * 2) << endl;
}

Re: A Java- / .NET-like monitor

<uii7ng$24dtg$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2571&group=comp.lang.c%2B%2B#2571

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsfeed.xs3.de!callisto.xs3.de!gandalf.srv.welterde.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 01:11:12 -0800
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uii7ng$24dtg$2@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 09:11:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2242480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18FiZ00yhwcl654GtNDAiF+j0A4ZRzXDo4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:5bQJyAEoBTzqCK2SAkmW76ZOvyg=
In-Reply-To: <uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 9 Nov 2023 09:11 UTC

On 11/9/2023 1:07 AM, Bonita Montero wrote:
> I did a test of my monitor against two mutexes and two condition
> variables, playing pingpong with each other. On Windows my imple-
> mentation is about 12 times faster than the mentioned mutex with
> condvar on a AMD 7950X Zen4 16 core system. Under WSL2 on the
> same machine the Linux implementation is 12% faster than my code.
> On Linux bare metal with a Zen2 3990X 64 core system my code is
> about 8.5% faster.
> As I recently found in this that a wait() incurs only one context
> switch back and forth I thought my code woudln't be faster, but
> on bare metal it actually is faster. And I was really surprised
> that the MS condvar implementation is that extremely slow compared
> to my monitor.
[...]

I am just starting to model some of my queue code. Its going to fun to
model your monitor and see if its bites the dust.

Re: A Java- / .NET-like monitor

<uii83k$24l1u$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2572&group=comp.lang.c%2B%2B#2572

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 10:17:42 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uii83k$24l1u$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<uii7ng$24dtg$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 09:17:40 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="a9604e3708dee71e445818bf67ac3a30";
logging-data="2249790"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NGZmmfxA+v8gT0LF/gaGAYFi+R3RrjtE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:A4zniYWYbHuzwZLXUukFZccRSRU=
Content-Language: de-DE
In-Reply-To: <uii7ng$24dtg$2@dont-email.me>
 by: Bonita Montero - Thu, 9 Nov 2023 09:17 UTC

Am 09.11.2023 um 10:11 schrieb Chris M. Thomasson:

> I am just starting to model some of my queue code. Its going to fun to
> model your monitor and see if its bites the dust.

The advantage under Linux bare metal is only 12%, if you do additional
things in userspace the effect should become smaller. So measuring a
simple bool ping pong shows almost the sole performance of my code.
But you would get a noticeable difference with Windows.

Re: A Java- / .NET-like monitor

<uii8c6$24dtg$4@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2573&group=comp.lang.c%2B%2B#2573

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsfeed.xs3.de!callisto.xs3.de!gandalf.srv.welterde.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 01:22:14 -0800
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <uii8c6$24dtg$4@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<uii7ng$24dtg$2@dont-email.me>
<uii83k$24l1u$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 09:22:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2242480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ylqOQg0tsD5xC+UjcqCm5Tb9NDR0xz5I="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ksJKeNzk8ueqiYK1D4yLQ2AIvpA=
Content-Language: en-US
In-Reply-To: <uii83k$24l1u$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Thu, 9 Nov 2023 09:22 UTC

On 11/9/2023 1:17 AM, Bonita Montero wrote:
> Am 09.11.2023 um 10:11 schrieb Chris M. Thomasson:
>
>> I am just starting to model some of my queue code. Its going to fun to
>> model your monitor and see if its bites the dust.
>
> The advantage under Linux bare metal is only 12%, if you do additional
> things in userspace the effect should become smaller. So measuring a
> simple bool ping pong shows almost the sole performance of my code.
> But you would get a noticeable difference with Windows.
>
>
>

Modeling it is not about sheer performance, it is about correctness.

Re: A Java- / .NET-like monitor

<uii8dm$24dtg$5@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2574&group=comp.lang.c%2B%2B#2574

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Thu, 9 Nov 2023 01:23:02 -0800
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <uii8dm$24dtg$5@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<uii7ng$24dtg$2@dont-email.me>
<uii83k$24l1u$1@raubtier-asyl.eternal-september.org>
<uii8c6$24dtg$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 09:23:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c15d53f2796d981aaf0ad9fa13a4e8bd";
logging-data="2242480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/P3dsdIj8rFqgA18T8jH704O/9NUN2/VE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:jERSZ4S2qzNEREVuT/hUPn6Mego=
In-Reply-To: <uii8c6$24dtg$4@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 9 Nov 2023 09:23 UTC

On 11/9/2023 1:22 AM, Chris M. Thomasson wrote:
> On 11/9/2023 1:17 AM, Bonita Montero wrote:
>> Am 09.11.2023 um 10:11 schrieb Chris M. Thomasson:
>>
>>> I am just starting to model some of my queue code. Its going to fun
>>> to model your monitor and see if its bites the dust.
>>
>> The advantage under Linux bare metal is only 12%, if you do additional
>> things in userspace the effect should become smaller. So measuring a
>> simple bool ping pong shows almost the sole performance of my code.
>> But you would get a noticeable difference with Windows.
>>
>>
>>
>
> Modeling it is not about sheer performance, it is about correctness.

Make sure it is sound and correct first, then we can sit back and think
about how to make it much faster...

Re: A Java- / .NET-like monitor

<fEq3N.11675$Ee89.8813@fx17.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2575&group=comp.lang.c%2B%2B#2575

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c++
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: A Java- / .NET-like monitor
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
User-Agent: slrn/1.0.3 (Darwin)
Lines: 39
Message-ID: <fEq3N.11675$Ee89.8813@fx17.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Fri, 10 Nov 2023 13:56:27 UTC
Organization: usenet-news.net
Date: Fri, 10 Nov 2023 13:56:27 GMT
X-Received-Bytes: 3520
 by: Branimir Maksimovic - Fri, 10 Nov 2023 13:56 UTC

On 2023-11-09, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> I did a test of my monitor against two mutexes and two condition
> variables, playing pingpong with each other. On Windows my imple-
> mentation is about 12 times faster than the mentioned mutex with
> condvar on a AMD 7950X Zen4 16 core system. Under WSL2 on the
> same machine the Linux implementation is 12% faster than my code.
> On Linux bare metal with a Zen2 3990X 64 core system my code is
> about 8.5% faster.
> As I recently found in this that a wait() incurs only one context
> switch back and forth I thought my code woudln't be faster, but
> on bare metal it actually is faster. And I was really surprised
> that the MS condvar implementation is that extremely slow compared
> to my monitor.
>
here is what i got on macOS:
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x000000018c33d0bc libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x000000018c374cc0 libsystem_pthread.dylib`pthread_kill + 288
frame #2: 0x000000018c280a40 libsystem_c.dylib`abort + 180
frame #3: 0x000000018c32c070 libc++abi.dylib`abort_message + 132
frame #4: 0x000000018c31c004 libc++abi.dylib`demangling_terminate_handler() + 52
frame #5: 0x000000018c32b434 libc++abi.dylib`std::__terminate(void (*)()) + 16
frame #6: 0x000000018c32b390 libc++abi.dylib`std::terminate() + 36
frame #7: 0x000000018c2aa714 libc++.1.dylib`std::__1::thread::~thread() + 32
frame #8: 0x0000000100007cd0 cond_var`void std::__1::__destroy_at[abi:v160006]<std::__1::thread, 0>(__loc=0x00006000036c4028) at construct_at.h:66:13
frame #9: 0x0000000100007cac cond_var`void std::__1::destroy_at[abi:v160006]<std::__1::thread, 0>(__loc=0x00006000036c4028) at construct_at.h:101:5
frame #10: 0x0000000100007c10 cond_var`void std::__1::allocator_traits<std::__1::allocator<std::__1::thread>>::destroy[abi:v160006]<std::__1::thread, void, void>((null)=0x000000016fdff040, __p=0x00006000036c4028) at allocator_traits.h:323:9
frame #11: 0x000000010000a090 cond_var`std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread>>::__base_destruct_at_end[abi:v160006](this=0x000000016fdff030 size=2, __new_last=0x00006000036c4020) at vector:836:9
frame #12: 0x0000000100009d10 cond_var`std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread>>::__destruct_at_end[abi:v160006](this=0x000000016fdff030 size=2, __new_last=0x00006000036c4020) at vector:724:9
frame #13: 0x00000001000063d4 cond_var`std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread>>::resize(this=0x000000016fdff030 size=2, __sz=0) at vector:1912:15
frame #14: 0x0000000100005eec cond_var`main(argc=1, argv=0x000000016fdff420) at test_cond.cpp:52:10
frame #15: 0x000000018bff50e0 dyld`start + 2360

--

7-77-777, Evil Sinner!
https://www.linkedin.com/in/branimir-maksimovic-6762bbaa/

Re: A Java- / .NET-like monitor

<uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2576&group=comp.lang.c%2B%2B#2576

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 10 Nov 2023 15:08:50 +0100
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<fEq3N.11675$Ee89.8813@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 10 Nov 2023 14:08:48 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="cda41ff1edf451ee4e799e1a292e5a8c";
logging-data="3014586"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bE8bmoM8htvA5STQfrWUR5jEKEkiXPNk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ok4oRlBr9MAb0zOAiIb6I9BJ54Q=
In-Reply-To: <fEq3N.11675$Ee89.8813@fx17.iad>
Content-Language: de-DE
 by: Bonita Montero - Fri, 10 Nov 2023 14:08 UTC

Am 10.11.2023 um 14:56 schrieb Branimir Maksimovic:

> frame #13: 0x00000001000063d4 cond_var`std::__1::vector<std::__1::thread, std::__1::allocator<std::__1::thread>>::resize(this=0x000000016fdff030 size=2, __sz=0) at vector:1912:15
> frame #14: 0x0000000100005eec cond_var`main(argc=1, argv=0x000000016fdff420) at test_cond.cpp:52:10
> frame #15: 0x000000018bff50e0 dyld`start + 2360

It seems that resizing the thread-vector while doing an emplace_back(),
which itself seems to be inlined, fails. I don't know why.

Re: A Java- / .NET-like monitor

<uildu6$2s2ao$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2577&group=comp.lang.c%2B%2B#2577

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 10 Nov 2023 15:15:36 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <uildu6$2s2ao$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<fEq3N.11675$Ee89.8813@fx17.iad>
<uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 10 Nov 2023 14:15:34 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="cda41ff1edf451ee4e799e1a292e5a8c";
logging-data="3017048"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bzS/WoY/W4kui0aceyAr2Qab0912ZLZU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:01PlyEtbmXJK6xNT1ycFViG0Afg=
Content-Language: de-DE
In-Reply-To: <uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
 by: Bonita Montero - Fri, 10 Nov 2023 14:15 UTC

Am 10.11.2023 um 15:08 schrieb Bonita Montero:
> Am 10.11.2023 um 14:56 schrieb Branimir Maksimovic:
>
>>      frame #13: 0x00000001000063d4
>> cond_var`std::__1::vector<std::__1::thread,
>> std::__1::allocator<std::__1::thread>>::resize(this=0x000000016fdff030
>> size=2, __sz=0) at vector:1912:15
>>      frame #14: 0x0000000100005eec cond_var`main(argc=1,
>> argv=0x000000016fdff420) at test_cond.cpp:52:10
>>      frame #15: 0x000000018bff50e0 dyld`start + 2360
>
> It seems that resizing the thread-vector while doing an emplace_back(),
> which itself seems to be inlined, fails. I don't know why.

I think I've got it: I'm using C++20 jthreads which are joined on the
destruction of the jthread object. I'm just resizing the jthread vector
to join both threads. But your jthread-implementation seems to behave
like a normal C++11 thread which calls abort() on destruction when a
thread which is joinable and not joind.
You may verify that with this code.

#include <thread>

using namespace std;

int main()
{ (void)jthread( []() { this_thread::sleep_for( 1s ); } );
}

The temporary is very like to be destructed before the thread
is terminated.

Re: A Java- / .NET-like monitor

<uim4o5$30nss$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2579&group=comp.lang.c%2B%2B#2579

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 10 Nov 2023 12:44:52 -0800
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uim4o5$30nss$2@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<fEq3N.11675$Ee89.8813@fx17.iad>
<uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 10 Nov 2023 20:44:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a600364f4e67105389993083039debad";
logging-data="3170204"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/s5QLNApa4WNNF8zkpoDMLqwYr+wtlDD4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:oR0tm0Q9LDbo+EeQjZ1n082tMHU=
In-Reply-To: <uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 10 Nov 2023 20:44 UTC

On 11/10/2023 6:08 AM, Bonita Montero wrote:
> Am 10.11.2023 um 14:56 schrieb Branimir Maksimovic:
>
>>      frame #13: 0x00000001000063d4
>> cond_var`std::__1::vector<std::__1::thread,
>> std::__1::allocator<std::__1::thread>>::resize(this=0x000000016fdff030
>> size=2, __sz=0) at vector:1912:15
>>      frame #14: 0x0000000100005eec cond_var`main(argc=1,
>> argv=0x000000016fdff420) at test_cond.cpp:52:10
>>      frame #15: 0x000000018bff50e0 dyld`start + 2360
>
> It seems that resizing the thread-vector while doing an emplace_back(),
> which itself seems to be inlined, fails. I don't know why.
>

You should of modeled in a race-detector first!

Re: A Java- / .NET-like monitor

<A6C3N.7536$wvv7.7234@fx14.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2580&group=comp.lang.c%2B%2B#2580

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
Newsgroups: comp.lang.c++
From: branimir...@icloud.com (Branimir Maksimovic)
Subject: Re: A Java- / .NET-like monitor
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<fEq3N.11675$Ee89.8813@fx17.iad>
<uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
<uildu6$2s2ao$1@raubtier-asyl.eternal-september.org>
User-Agent: slrn/1.0.3 (Darwin)
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Lines: 48
Message-ID: <A6C3N.7536$wvv7.7234@fx14.iad>
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Sat, 11 Nov 2023 02:59:44 UTC
Organization: usenet-news.net
Date: Sat, 11 Nov 2023 02:59:44 GMT
X-Received-Bytes: 2522
 by: Branimir Maksimovic - Sat, 11 Nov 2023 02:59 UTC

On 2023-11-10, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 10.11.2023 um 15:08 schrieb Bonita Montero:
>> Am 10.11.2023 um 14:56 schrieb Branimir Maksimovic:
>>
>>>      frame #13: 0x00000001000063d4
>>> cond_var`std::__1::vector<std::__1::thread,
>>> std::__1::allocator<std::__1::thread>>::resize(this=0x000000016fdff030
>>> size=2, __sz=0) at vector:1912:15
>>>      frame #14: 0x0000000100005eec cond_var`main(argc=1,
>>> argv=0x000000016fdff420) at test_cond.cpp:52:10
>>>      frame #15: 0x000000018bff50e0 dyld`start + 2360
>>
>> It seems that resizing the thread-vector while doing an emplace_back(),
>> which itself seems to be inlined, fails. I don't know why.
>
> I think I've got it: I'm using C++20 jthreads which are joined on the
> destruction of the jthread object. I'm just resizing the jthread vector
> to join both threads. But your jthread-implementation seems to behave
> like a normal C++11 thread which calls abort() on destruction when a
> thread which is joinable and not joind.
> You may verify that with this code.
>
> #include <thread>
>
> using namespace std;
>
> int main()
> {
> (void)jthread( []() { this_thread::sleep_for( 1s ); } );
> }
>
> The temporary is very like to be destructed before the thread
> is terminated.
>

yes, i don't have jthread. Will try with g++ rather clang...
Yeeee, real g++ has jthread:

--
la@MacBook-Air News % g++-13 -O3 cond_var.cpp test_cond.cpp -o cond_var -std=c++20 -D__unix__
ld: warning: ignoring duplicate libraries: '-lgcc'
Lola@MacBook-Air News % ./cond_var
3881.83
2984.36
Lola@MacBook-Air News %

7-77-777, Evil Sinner!
https://www.linkedin.com/in/branimir-maksimovic-6762bbaa/

Re: A Java- / .NET-like monitor

<uimtsn$38rgf$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2581&group=comp.lang.c%2B%2B#2581

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Sat, 11 Nov 2023 04:53:59 +0100
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <uimtsn$38rgf$1@raubtier-asyl.eternal-september.org>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<fEq3N.11675$Ee89.8813@fx17.iad>
<uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
<uim4o5$30nss$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 11 Nov 2023 03:53:59 -0000 (UTC)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="064445d7139efe966d430f568a2a375e";
logging-data="3436047"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19V+KxdKkFINfhNIicuuHABctrfM2DBI2g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XssSW0guzTF02e9rySU69sMF37s=
In-Reply-To: <uim4o5$30nss$2@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Sat, 11 Nov 2023 03:53 UTC

Am 10.11.2023 um 21:44 schrieb Chris M. Thomasson:
> On 11/10/2023 6:08 AM, Bonita Montero wrote:
>> Am 10.11.2023 um 14:56 schrieb Branimir Maksimovic:
>>
>>>      frame #13: 0x00000001000063d4
>>> cond_var`std::__1::vector<std::__1::thread,
>>> std::__1::allocator<std::__1::thread>>::resize(this=0x000000016fdff030 size=2, __sz=0) at vector:1912:15
>>>      frame #14: 0x0000000100005eec cond_var`main(argc=1,
>>> argv=0x000000016fdff420) at test_cond.cpp:52:10
>>>      frame #15: 0x000000018bff50e0 dyld`start + 2360
>>
>> It seems that resizing the thread-vector while doing an emplace_back(),
>> which itself seems to be inlined, fails. I don't know why.
>>
>
> You should of modeled in a race-detector first!

To find bugs inside his jthread-implementation ?

Re: A Java- / .NET-like monitor

<uimuqm$38vmc$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2582&group=comp.lang.c%2B%2B#2582

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: A Java- / .NET-like monitor
Date: Fri, 10 Nov 2023 20:09:57 -0800
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uimuqm$38vmc$1@dont-email.me>
References: <uig7jl$1l4v0$1@raubtier-asyl.eternal-september.org>
<uii7h9$24flo$1@raubtier-asyl.eternal-september.org>
<fEq3N.11675$Ee89.8813@fx17.iad>
<uildhg$2rvtq$1@raubtier-asyl.eternal-september.org>
<uim4o5$30nss$2@dont-email.me>
<uimtsn$38rgf$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 11 Nov 2023 04:09:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b95bdab731045aab656ae9b9e9ad38d8";
logging-data="3440332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JBtCnOPulIXruFVOWMyS3KZhgmGpr+FU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:7T14z/uTtg+Stt/0twjOVSahU4Y=
In-Reply-To: <uimtsn$38rgf$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Sat, 11 Nov 2023 04:09 UTC

On 11/10/2023 7:53 PM, Bonita Montero wrote:
> Am 10.11.2023 um 21:44 schrieb Chris M. Thomasson:
>> On 11/10/2023 6:08 AM, Bonita Montero wrote:
>>> Am 10.11.2023 um 14:56 schrieb Branimir Maksimovic:
>>>
>>>>      frame #13: 0x00000001000063d4
>>>> cond_var`std::__1::vector<std::__1::thread,
>>>> std::__1::allocator<std::__1::thread>>::resize(this=0x000000016fdff030 size=2, __sz=0) at vector:1912:15
>>>>      frame #14: 0x0000000100005eec cond_var`main(argc=1,
>>>> argv=0x000000016fdff420) at test_cond.cpp:52:10
>>>>      frame #15: 0x000000018bff50e0 dyld`start + 2360
>>>
>>> It seems that resizing the thread-vector while doing an emplace_back(),
>>> which itself seems to be inlined, fails. I don't know why.
>>>
>>
>> You should of modeled in a race-detector first!
>
> To find bugs inside his jthread-implementation ?
>

To help find a bug, yup. Think it up, draft it out, create test units,
model them with a race detector, Get it working... Then, we can think
about improving performance.


devel / comp.lang.c++ / Re: A Java- / .NET-like monitor

Pages:1234567891011
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor