Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

19 May, 2024: Line wrapping has been changed to be more consistent with Usenet standards.
 If you find that it is broken please let me know here rocksolid.nodes.help


devel / comp.lang.c++ / Re: C++20 futex with heavy contention slower than mutex

SubjectAuthor
* C++20 futex with heavy contention slower than mutexBonita Montero
+* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
|+* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||`* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
|| +- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
|| `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||  `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   +- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   +* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |`* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   | `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |  `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |   `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |    `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |     `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |      `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |       `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |        `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |         `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |          `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |           `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |            `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |             +* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |             |`- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |             +- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |             `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |              `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |               `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                 `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  +* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |`* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  | `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |  `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   +* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |+- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |`* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   | `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |  `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |   `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |    `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |     `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |      `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |       `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |        +* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |        |`* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |        | `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |        |  `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |        |   `- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |        `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  |   |         `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |          `* Re: C++20 futex with heavy contention slower than mutexRichard Damon
||   |                  |   |           `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |            +* Re: C++20 futex with heavy contention slower than mutexScott Lurndal
||   |                  |   |            |`* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |            | `* Re: C++20 futex with heavy contention slower than mutexScott Lurndal
||   |                  |   |            |  `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |            |   `* Re: C++20 futex with heavy contention slower than mutexScott Lurndal
||   |                  |   |            |    `* Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |            |     `* Re: C++20 futex with heavy contention slower than mutexScott Lurndal
||   |                  |   |            |      `- Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   |            `* Re: C++20 futex with heavy contention slower than mutexRichard Damon
||   |                  |   |             `- Re: C++20 futex with heavy contention slower than mutexBonita Montero
||   |                  |   `- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   |                  `- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||   `* Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
||    `- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
|`- Re: C++20 futex with heavy contention slower than mutexBonita Montero
+- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson
`* Re: C++20 futex with heavy contention slower than mutexMichael S
 `- Re: C++20 futex with heavy contention slower than mutexChris M. Thomasson

Pages:123
Re: C++20 futex with heavy contention slower than mutex

<uvju09$enhv$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.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: C++20 futex with heavy contention slower than mutex
Date: Mon, 15 Apr 2024 12:08:57 -0700
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uvju09$enhv$1@dont-email.me>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvc8c4$2ik6i$1@dont-email.me>
<uvclf0$2l4bk$1@raubtier-asyl.eternal-september.org>
<uvem9v$35hth$1@dont-email.me>
<uvflfv$3f7ep$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$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: Mon, 15 Apr 2024 21:08:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7d60a1f57502b9704c1d77fb39f6ec8f";
logging-data="482879"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18czOjN8K1SzxNw9vETOIcZJyC3mA5gASA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:mj9MWUw7PeoIJmvvboP/yupqlvg=
Content-Language: en-US
In-Reply-To: <uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Mon, 15 Apr 2024 19:08 UTC

On 4/14/2024 11:20 PM, Bonita Montero wrote:
> Am 15.04.2024 um 07:03 schrieb Chris M. Thomasson:
>
>> On 4/14/2024 9:15 PM, Bonita Montero wrote:
>
>>> Absolutely not, but you consider a futex wake as slow.
>
>> Yes. I consider a futex notify and wake as "slow" paths.
>
> I've mentioned that a futex wake with no contenders is 1.7ns or about
> 10 clock cycles on my Zen4-CPU; that's nothing worth to think about.
>

I don't know what that futex notify is actually doing under the covers.
One impl might be faster than another. Whatever. I still consider a
futex notify to be a slow path because it denotes contention. Trying to
avoid a call into it is still rather "prudent", well according to me.
Why call a notify when we do not have to?

Re: C++20 futex with heavy contention slower than mutex

<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Tue, 16 Apr 2024 06:32:11 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvclf0$2l4bk$1@raubtier-asyl.eternal-september.org>
<uvem9v$35hth$1@dont-email.me>
<uvflfv$3f7ep$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 16 Apr 2024 06:32:10 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="838a6bcf0fa6b6326c0e9c98044ca4bc";
logging-data="814752"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gOUHpmawSYs8Ay763bIGf503Xn9lj908="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ECVzVSeInHcvYZabYw9i+Y4VXEk=
In-Reply-To: <uvju09$enhv$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Tue, 16 Apr 2024 04:32 UTC

Am 15.04.2024 um 21:08 schrieb Chris M. Thomasson:

> I don't know what that futex notify is actually doing under the covers.

In 10 clock cycles you can't do much.

> One impl might be faster than another.

With Windows it's ony 2.7ns and with Linux 1.7ns.

Re: C++20 futex with heavy contention slower than mutex

<uvlghl$sf25$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Tue, 16 Apr 2024 11:31:34 +0200
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <uvlghl$sf25$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvem9v$35hth$1@dont-email.me>
<uvflfv$3f7ep$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$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: Tue, 16 Apr 2024 11:31:34 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="838a6bcf0fa6b6326c0e9c98044ca4bc";
logging-data="932933"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/b/5yZXBgFC+HeZIeDcuiIXMwS/s1bPw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:KkXD+zJfk6PVMYIJZRpu+X6Syyw=
Content-Language: de-DE
In-Reply-To: <uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
 by: Bonita Montero - Tue, 16 Apr 2024 09:31 UTC

Am 16.04.2024 um 06:32 schrieb Bonita Montero:
> Am 15.04.2024 um 21:08 schrieb Chris M. Thomasson:
>
>> I don't know what that futex notify is actually doing under the covers.
>
> In 10 clock cycles you can't do much.
>
>> One impl might be faster than another.
>
>
> With Windows it's ony 2.7ns and with Linux 1.7ns.

Try it yourself:

#include <iostream>
#include <atomic>
#include <chrono>

using namespace std;
using namespace chrono;

int main()
{ atomic_bool ab;
auto start = high_resolution_clock::now();
for( size_t i = 1'000'000'000; i; --i )
ab.notify_one();
cout << duration_cast<nanoseconds>( high_resolution_clock::now() -
start ).count() / 1.0e9 << endl;
}

With WSL2 on a Zen4-CPU it's only 1.2ns, i.e. seven clock cycles.

Re: C++20 futex with heavy contention slower than mutex

<uvmpan$155mq$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.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: C++20 futex with heavy contention slower than mutex
Date: Tue, 16 Apr 2024 14:07:35 -0700
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <uvmpan$155mq$1@dont-email.me>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvlghl$sf25$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: Tue, 16 Apr 2024 23:07:35 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8bbe6702323a2c8dcfc05821f328ef73";
logging-data="1218266"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7L58PuXu/b5LUaMoJkBPaWbNf75A8MVw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:0eFLF7+iInT0is6iVgCqz4QrJO8=
Content-Language: en-US
In-Reply-To: <uvlghl$sf25$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Tue, 16 Apr 2024 21:07 UTC

On 4/16/2024 2:31 AM, Bonita Montero wrote:
> Am 16.04.2024 um 06:32 schrieb Bonita Montero:
>> Am 15.04.2024 um 21:08 schrieb Chris M. Thomasson:
>>
>>> I don't know what that futex notify is actually doing under the covers.
>>
>> In 10 clock cycles you can't do much.
>>
>>> One impl might be faster than another.
>>
>>
>> With Windows it's ony 2.7ns and with Linux 1.7ns.
>
> Try it yourself:
>
> #include <iostream>
> #include <atomic>
> #include <chrono>
>
> using namespace std;
> using namespace chrono;
>
> int main()
> {
>     atomic_bool ab;
>     auto start = high_resolution_clock::now();
>     for( size_t i = 1'000'000'000; i; --i )
>         ab.notify_one();
>     cout << duration_cast<nanoseconds>( high_resolution_clock::now() -
> start ).count() / 1.0e9 << endl;
> }
>
> With WSL2 on a Zen4-CPU it's only 1.2ns, i.e. seven clock cycles.
>

I will, however I am working on another project right now, heavy
graphics based. Basically, I would want to see how notify_one is
actually implemented. Bust out the disassembler.

Re: C++20 futex with heavy contention slower than mutex

<uvmpnh$155mq$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.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: C++20 futex with heavy contention slower than mutex
Date: Tue, 16 Apr 2024 14:14:25 -0700
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uvmpnh$155mq$2@dont-email.me>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvem9v$35hth$1@dont-email.me>
<uvflfv$3f7ep$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$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: Tue, 16 Apr 2024 23:14:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8bbe6702323a2c8dcfc05821f328ef73";
logging-data="1218266"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fnQZYFRA1d8LGtW3AfUReIJBeTHVyzs8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:aRzwEjJwZQ+X9r8E5R2Tt/c7LS8=
Content-Language: en-US
In-Reply-To: <uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Tue, 16 Apr 2024 21:14 UTC

On 4/15/2024 9:32 PM, Bonita Montero wrote:
> Am 15.04.2024 um 21:08 schrieb Chris M. Thomasson:
>
>> I don't know what that futex notify is actually doing under the covers.
>
> In 10 clock cycles you can't do much.

Well, futex notify might have fast paths in and of itself. To be prudent
I would need to see how they implement it to allow a futex notify by,
every time. Fair enough?

>
>> One impl might be faster than another.
>
>
> With Windows it's ony 2.7ns and with Linux 1.7ns.

Re: C++20 futex with heavy contention slower than mutex

<uvo0vi$1gaai$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Wed, 17 Apr 2024 10:24:20 +0200
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <uvo0vi$1gaai$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvlghl$sf25$1@raubtier-asyl.eternal-september.org>
<uvmpan$155mq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 17 Apr 2024 10:24:18 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="94c608ecfea7429c4d58373dfffed164";
logging-data="1583442"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+shulNl+59fjjQSE64F7SuLJzoRr1FMy0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:NOdXVOm/ggxpfhCz5unzsABX4B0=
In-Reply-To: <uvmpan$155mq$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Wed, 17 Apr 2024 08:24 UTC

Am 16.04.2024 um 23:07 schrieb Chris M. Thomasson:

> I will, however I am working on another project right now, heavy
> graphics based. Basically, I would want to see how notify_one is
> actually implemented. Bust out the disassembler.

It will practically not matter how it is implemented if it is that fast.

Re: C++20 futex with heavy contention slower than mutex

<uvp5i9$1oghe$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.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: C++20 futex with heavy contention slower than mutex
Date: Wed, 17 Apr 2024 11:48:42 -0700
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uvp5i9$1oghe$2@dont-email.me>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvlghl$sf25$1@raubtier-asyl.eternal-september.org>
<uvmpan$155mq$1@dont-email.me>
<uvo0vi$1gaai$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: Wed, 17 Apr 2024 20:48:42 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e2583a017ace5d616772eafd574ebb78";
logging-data="1851950"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Igeg3eAcD7OuireZKUpkFAhtoK9LmF3g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:j3KmmYn1x6xMSZlFEtLGyM6DEYM=
In-Reply-To: <uvo0vi$1gaai$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 17 Apr 2024 18:48 UTC

On 4/17/2024 1:24 AM, Bonita Montero wrote:
> Am 16.04.2024 um 23:07 schrieb Chris M. Thomasson:
>
>> I will, however I am working on another project right now, heavy
>> graphics based. Basically, I would want to see how notify_one is
>> actually implemented. Bust out the disassembler.
>
> It will practically not matter how it is implemented if it is that fast.

It just might take an internal hashed mutex to check for contention...
Humm... I don't know until I look at it. I don't even want it to do a
CAS, or execute any membars on a "fast-path". Since I don't know what
its doing under the covers, I still think its "prudent" to try to avoid
calling into it when we do absolutely have to.

Re: C++20 futex with heavy contention slower than mutex

<uvp5ot$1ogga$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.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: C++20 futex with heavy contention slower than mutex
Date: Wed, 17 Apr 2024 11:52:13 -0700
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <uvp5ot$1ogga$1@dont-email.me>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvlghl$sf25$1@raubtier-asyl.eternal-september.org>
<uvmpan$155mq$1@dont-email.me>
<uvo0vi$1gaai$1@raubtier-asyl.eternal-september.org>
<uvp5i9$1oghe$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 17 Apr 2024 20:52:13 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e2583a017ace5d616772eafd574ebb78";
logging-data="1851914"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HLpv+yw1ub4mpp8GiiHSIiWRWDaIfsTM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:R5DGYQuFVf0oluxkPKV3S6FFh0M=
In-Reply-To: <uvp5i9$1oghe$2@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 17 Apr 2024 18:52 UTC

On 4/17/2024 11:48 AM, Chris M. Thomasson wrote:
> On 4/17/2024 1:24 AM, Bonita Montero wrote:
>> Am 16.04.2024 um 23:07 schrieb Chris M. Thomasson:
>>
>>> I will, however I am working on another project right now, heavy
>>> graphics based. Basically, I would want to see how notify_one is
>>> actually implemented. Bust out the disassembler.
>>
>> It will practically not matter how it is implemented if it is that fast.
>
> It just might take an internal hashed mutex to check for contention...
> Humm... I don't know until I look at it. I don't even want it to do a
> CAS, or execute any membars on a "fast-path". Since I don't know what
> its doing under the covers, I still think its "prudent" to try to avoid
> calling into it when we do absolutely have to.
^^^^^^^^^^^^^^

God damn typos! Sorry Bonita!

I still think its "prudent" to try to avoid calling into it, _except_
when we absolutely have to.

Argh! Sorry again.

Re: C++20 futex with heavy contention slower than mutex

<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Thu, 18 Apr 2024 15:12:22 +0200
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvflfv$3f7ep$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 18 Apr 2024 15:12:20 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="bc79f832f002438588aaf71e6e98ab5b";
logging-data="2397886"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lEUwsJmkcpGDDu7WNbNsDj/+qXdZ08ok="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:H5dgx/p0paRUwgweS/9eIzpAFb0=
Content-Language: de-DE
In-Reply-To: <uvmpnh$155mq$2@dont-email.me>
 by: Bonita Montero - Thu, 18 Apr 2024 13:12 UTC

Am 16.04.2024 um 23:14 schrieb Chris M. Thomasson:

> Well, futex notify might have fast paths in and of itself. To be prudent
> I would need to see how they implement it to allow a futex notify by,
> every time. Fair enough?

I'm asking myself if it would be possible to have context-switching as
most as possible in userspace. If there would be a context-switch from
one thread of a process to another thread because a timeslice expired
the kernel should send a signal to the thread and the thread does the
userspace context-switch by itself. Only if there's a context switch
to another process' thread or in kernel mode the kernel's scheduler
acts itself.
This would give the opportunity to have voluntary context switches
when doing locking much faster than trough the kernel, and voluntary
context switches usually happen with a much higher frequency that
there would be a real gain.
With Linux this would be possible trough signals and on Windows the
kernel could induce SEH-exceptions for a thread-switch.

Re: C++20 futex with heavy contention slower than mutex

<uvsjd0$1h01e$2@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: C++20 futex with heavy contention slower than mutex
Date: Thu, 18 Apr 2024 22:03:12 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <uvsjd0$1h01e$2@i2pn2.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvflt5$3fa23$1@dont-email.me>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$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: Fri, 19 Apr 2024 02:03:12 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="1605678"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: Richard Damon - Fri, 19 Apr 2024 02:03 UTC

On 4/18/24 9:12 AM, Bonita Montero wrote:
> Am 16.04.2024 um 23:14 schrieb Chris M. Thomasson:
>
>> Well, futex notify might have fast paths in and of itself. To be
>> prudent I would need to see how they implement it to allow a futex
>> notify by, every time. Fair enough?
>
> I'm asking myself if it would be possible to have context-switching as
> most as possible in userspace. If there would be a context-switch from
> one thread of a process to another thread because a timeslice expired
> the kernel should send a signal to the thread and the thread does the
> userspace context-switch by itself. Only if there's a context switch
> to another process' thread or in kernel mode the kernel's scheduler
> acts itself.
> This would give the opportunity to have voluntary context switches
> when doing locking much faster than trough the kernel, and voluntary
> context switches usually happen with a much higher frequency that
> there would be a real gain.
> With Linux this would be possible trough signals and on Windows the
> kernel could induce SEH-exceptions for a thread-switch.
>

How do you "signal" a user-thread without doing a kernel operation and a
thread switch?

Admittedly, if the kernel knows it is switching from one thread to
another in the same process it can do a lighter weight sort of
context-switch, but it still needs to deal with kernel space operations.

Re: C++20 futex with heavy contention slower than mutex

<uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Fri, 19 Apr 2024 06:18:18 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvfm5m$3fblc$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
<uvsjd0$1h01e$2@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 19 Apr 2024 06:18:15 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="45f1588adceccf755fc152def21f0d95";
logging-data="2881679"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qOMf2UfVxeIYHxzbno/+EMFmumUNLfHw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cEArAvDb2/NvIdjQfxdXf9quTk8=
In-Reply-To: <uvsjd0$1h01e$2@i2pn2.org>
Content-Language: de-DE
 by: Bonita Montero - Fri, 19 Apr 2024 04:18 UTC

Am 19.04.2024 um 04:03 schrieb Richard Damon:

> How do you "signal" a user-thread without doing a kernel operation
> and a thread switch?

The signals for the involuntary userspace thread-switch would be sent
by a dedicated kernel-thread or by the timer interrupt. This would be
more expensive than a thread-switch through the timer interrupt but
as voluntary thread-switches have a much higher frequency this would
be outweighed.

> Admittedly, if the kernel knows it is switching from one thread
> to another in the same process it can do a lighter weight sort of
> context-switch, but it still needs to deal with kernel space operations.

A context switch through the kernel is always expensive. A user
-level thread switch when blocking for a lock would be much faster.

Re: C++20 futex with heavy contention slower than mutex

<kwuUN.8266$moa7.3858@fx18.iad>

  copy mid

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

  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!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: C++20 futex with heavy contention slower than mutex
Newsgroups: comp.lang.c++
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org> <uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me> <uvi9lk$3huv$1@raubtier-asyl.eternal-september.org> <uvicet$404o$1@dont-email.me> <uvigvt$4r0r$1@raubtier-asyl.eternal-september.org> <uvju09$enhv$1@dont-email.me> <uvkv0a$orl0$1@raubtier-asyl.eternal-september.org> <uvmpnh$155mq$2@dont-email.me> <uvr67j$295lu$1@raubtier-asyl.eternal-september.org> <uvsjd0$1h01e$2@i2pn2.org> <uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
Lines: 12
Message-ID: <kwuUN.8266$moa7.3858@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 19 Apr 2024 13:41:36 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 19 Apr 2024 13:41:36 GMT
X-Received-Bytes: 1620
 by: Scott Lurndal - Fri, 19 Apr 2024 13:41 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 19.04.2024 um 04:03 schrieb Richard Damon:

>> Admittedly, if the kernel knows it is switching from one thread
>> to another in the same process it can do a lighter weight sort of
>> context-switch, but it still needs to deal with kernel space operations.
>
>A context switch through the kernel is always expensive. A user
>-level thread switch when blocking for a lock would be much faster.

SVR4.2MP implemented a M-N thread model (M user threads mapped to
N kernel threads). Turned out not to work well.

Re: C++20 futex with heavy contention slower than mutex

<uvtsg1$317v9$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Fri, 19 Apr 2024 15:44:37 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uvtsg1$317v9$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
<uvsjd0$1h01e$2@i2pn2.org>
<uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
<kwuUN.8266$moa7.3858@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 19 Apr 2024 15:44:33 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="45f1588adceccf755fc152def21f0d95";
logging-data="3186665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Fx7z8U0dh57TEqNVmdOtKiGJRs9jku/M="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:GWff/PWtaadrt7Ee+kHW3JdEnBI=
In-Reply-To: <kwuUN.8266$moa7.3858@fx18.iad>
Content-Language: de-DE
 by: Bonita Montero - Fri, 19 Apr 2024 13:44 UTC

Am 19.04.2024 um 15:41 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 19.04.2024 um 04:03 schrieb Richard Damon:
>
>>> Admittedly, if the kernel knows it is switching from one thread
>>> to another in the same process it can do a lighter weight sort of
>>> context-switch, but it still needs to deal with kernel space operations.
>>
>> A context switch through the kernel is always expensive. A user
>> -level thread switch when blocking for a lock would be much faster.
>
> SVR4.2MP implemented a M-N thread model (M user threads mapped to
> N kernel threads). Turned out not to work well.

The thing that I'm imaging is still 1:1 but if threads are in userspace
thread-switching would be done by the userspace.

Re: C++20 futex with heavy contention slower than mutex

<gvvUN.8268$moa7.5628@fx18.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: C++20 futex with heavy contention slower than mutex
Newsgroups: comp.lang.c++
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org> <uvicet$404o$1@dont-email.me> <uvigvt$4r0r$1@raubtier-asyl.eternal-september.org> <uvju09$enhv$1@dont-email.me> <uvkv0a$orl0$1@raubtier-asyl.eternal-september.org> <uvmpnh$155mq$2@dont-email.me> <uvr67j$295lu$1@raubtier-asyl.eternal-september.org> <uvsjd0$1h01e$2@i2pn2.org> <uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org> <kwuUN.8266$moa7.3858@fx18.iad> <uvtsg1$317v9$1@raubtier-asyl.eternal-september.org>
Lines: 20
Message-ID: <gvvUN.8268$moa7.5628@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 19 Apr 2024 14:48:44 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 19 Apr 2024 14:48:44 GMT
X-Received-Bytes: 1936
 by: Scott Lurndal - Fri, 19 Apr 2024 14:48 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 19.04.2024 um 15:41 schrieb Scott Lurndal:
>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>> Am 19.04.2024 um 04:03 schrieb Richard Damon:
>>
>>>> Admittedly, if the kernel knows it is switching from one thread
>>>> to another in the same process it can do a lighter weight sort of
>>>> context-switch, but it still needs to deal with kernel space operations.
>>>
>>> A context switch through the kernel is always expensive. A user
>>> -level thread switch when blocking for a lock would be much faster.
>>
>> SVR4.2MP implemented a M-N thread model (M user threads mapped to
>> N kernel threads). Turned out not to work well.
>
>The thing that I'm imaging is still 1:1 but if threads are in userspace
>thread-switching would be done by the userspace.

Feel free to prototype it using setcontext(2), getcontext(2) and
makecontext(2).

Re: C++20 futex with heavy contention slower than mutex

<uvu2qh$32l42$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Fri, 19 Apr 2024 17:32:38 +0200
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <uvu2qh$32l42$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
<uvsjd0$1h01e$2@i2pn2.org>
<uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
<kwuUN.8266$moa7.3858@fx18.iad>
<uvtsg1$317v9$1@raubtier-asyl.eternal-september.org>
<gvvUN.8268$moa7.5628@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 19 Apr 2024 17:32:33 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="45f1588adceccf755fc152def21f0d95";
logging-data="3232898"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zWAHKEEvslbar13aji5aOYRt5srZxJIA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:btpY+CjuYFQ96qLJkTctZhWmFTc=
In-Reply-To: <gvvUN.8268$moa7.5628@fx18.iad>
Content-Language: de-DE
 by: Bonita Montero - Fri, 19 Apr 2024 15:32 UTC

Am 19.04.2024 um 16:48 schrieb Scott Lurndal:

> Feel free to prototype it using setcontext(2), getcontext(2) and
> makecontext(2).

I'd need the support of the kernel which should not make context
switches to another thread inside the same process if the thread
is within userspace. And the kernel should have to periodically
inject signals from the timer interrupt to userspace to make it
possible that the userspace-code does the involuntary context
-switch on its own. And I'd need synchronization-primitives like
mutexes and semaphores that would do the otherwise costly context
-switch in userspace; but that's rather easy compared to the kernel
support.

Re: C++20 futex with heavy contention slower than mutex

<6IyUN.532$Xphd.113@fx41.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-3.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.netnews.com!s1-3.netnews.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx41.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: C++20 futex with heavy contention slower than mutex
Newsgroups: comp.lang.c++
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org> <uvju09$enhv$1@dont-email.me> <uvkv0a$orl0$1@raubtier-asyl.eternal-september.org> <uvmpnh$155mq$2@dont-email.me> <uvr67j$295lu$1@raubtier-asyl.eternal-september.org> <uvsjd0$1h01e$2@i2pn2.org> <uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org> <kwuUN.8266$moa7.3858@fx18.iad> <uvtsg1$317v9$1@raubtier-asyl.eternal-september.org> <gvvUN.8268$moa7.5628@fx18.iad> <uvu2qh$32l42$1@raubtier-asyl.eternal-september.org>
Lines: 19
Message-ID: <6IyUN.532$Xphd.113@fx41.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 19 Apr 2024 18:27:14 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 19 Apr 2024 18:27:14 GMT
X-Received-Bytes: 1843
X-Original-Bytes: 1792
 by: Scott Lurndal - Fri, 19 Apr 2024 18:27 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 19.04.2024 um 16:48 schrieb Scott Lurndal:
>
>> Feel free to prototype it using setcontext(2), getcontext(2) and
>> makecontext(2).
>
>I'd need the support of the kernel which should not make context
>switches to another thread inside the same process if the thread
>is within userspace. And the kernel should have to periodically
>inject signals from the timer interrupt to userspace to make it
>possible that the userspace-code does the involuntary context
>-switch on its own. And I'd need synchronization-primitives like
>mutexes and semaphores that would do the otherwise costly context
>-switch in userspace; but that's rather easy compared to the kernel
>support.

https://www.kernel.org/

Feel free to modify the kernel to your heart's content.

Re: C++20 futex with heavy contention slower than mutex

<uvvaeb$3ehhr$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Sat, 20 Apr 2024 04:48:47 +0200
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uvvaeb$3ehhr$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
<uvsjd0$1h01e$2@i2pn2.org>
<uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
<kwuUN.8266$moa7.3858@fx18.iad>
<uvtsg1$317v9$1@raubtier-asyl.eternal-september.org>
<gvvUN.8268$moa7.5628@fx18.iad>
<uvu2qh$32l42$1@raubtier-asyl.eternal-september.org>
<6IyUN.532$Xphd.113@fx41.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 20 Apr 2024 04:48:44 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="14d6ddb846e8593f63920489669f92c8";
logging-data="3622459"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/omKV+8MA90WyNryk4OqIffku0+dEP6fw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:anJ7YqRi5gEFP6ryWMXNt8RQBrs=
Content-Language: de-DE
In-Reply-To: <6IyUN.532$Xphd.113@fx41.iad>
 by: Bonita Montero - Sat, 20 Apr 2024 02:48 UTC

Am 19.04.2024 um 20:27 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 19.04.2024 um 16:48 schrieb Scott Lurndal:
>>
>>> Feel free to prototype it using setcontext(2), getcontext(2) and
>>> makecontext(2).
>>
>> I'd need the support of the kernel which should not make context
>> switches to another thread inside the same process if the thread
>> is within userspace. And the kernel should have to periodically
>> inject signals from the timer interrupt to userspace to make it
>> possible that the userspace-code does the involuntary context
>> -switch on its own. And I'd need synchronization-primitives like
>> mutexes and semaphores that would do the otherwise costly context
>> -switch in userspace; but that's rather easy compared to the kernel
>> support.
>
> https://www.kernel.org/
>
> Feel free to modify the kernel to your heart's content.

Seems you don't understand the idead and you think this isn't
possible.

Re: C++20 futex with heavy contention slower than mutex

<uvvb42$1kece$7@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: C++20 futex with heavy contention slower than mutex
Date: Fri, 19 Apr 2024 23:00:18 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <uvvb42$1kece$7@i2pn2.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvfp6l$3fnnk$4@dont-email.me>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
<uvsjd0$1h01e$2@i2pn2.org>
<uvsra7$2nu4f$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: Sat, 20 Apr 2024 03:00:18 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="1718670"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: Richard Damon - Sat, 20 Apr 2024 03:00 UTC

On 4/19/24 12:18 AM, Bonita Montero wrote:
> Am 19.04.2024 um 04:03 schrieb Richard Damon:
>
>> How do you "signal" a user-thread without doing a kernel operation
>> and a thread switch?
>
> The signals for the involuntary userspace thread-switch would be sent
> by a dedicated kernel-thread or by the timer interrupt. This would be
> more expensive than a thread-switch through the timer interrupt but
> as voluntary thread-switches have a much higher frequency this would
> be outweighed.

TO WHAT?

Are you going to reserve a core with a dedicated thread to do this?

To "interrupt" a user thread to notify it, you would either need to
perform a context switch to save the threads previous context or make
the interrupt non-returnable. If you are going to context switch to the
notification thread, you might as well switch the the new user-thread
that you want to go to.

>
>> Admittedly, if the kernel knows it is switching from one thread
>> to another in the same process it can do a lighter weight sort of
>> context-switch, but it still needs to deal with kernel space operations.
>
> A context switch through the kernel is always expensive. A user
> -level thread switch when blocking for a lock would be much faster.

But you still had the kernal doing a context switch.

Re: C++20 futex with heavy contention slower than mutex

<uvvfa8$3fc0v$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Sat, 20 Apr 2024 06:11:57 +0200
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <uvvfa8$3fc0v$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvfpmd$3fuid$1@raubtier-asyl.eternal-september.org>
<uvfppb$3fnnk$5@dont-email.me>
<uvfq0j$3g0q2$1@raubtier-asyl.eternal-september.org>
<uvfqd2$3fnnk$6@dont-email.me>
<uvfqiq$3g3vr$1@raubtier-asyl.eternal-september.org>
<uvfqnt$3fnnk$8@dont-email.me>
<uvg7e6$3iius$1@raubtier-asyl.eternal-september.org>
<uvgkna$3l8fe$1@raubtier-asyl.eternal-september.org>
<uvh97q$3pep9$3@dont-email.me>
<uvhfvk$3r04b$1@raubtier-asyl.eternal-september.org>
<uvi6jh$2ubm$1@dont-email.me> <uvi6ol$2ubm$2@dont-email.me>
<uvi9lk$3huv$1@raubtier-asyl.eternal-september.org>
<uvicet$404o$1@dont-email.me>
<uvigvt$4r0r$1@raubtier-asyl.eternal-september.org>
<uvju09$enhv$1@dont-email.me>
<uvkv0a$orl0$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
<uvsjd0$1h01e$2@i2pn2.org>
<uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
<uvvb42$1kece$7@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 20 Apr 2024 06:11:53 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="14d6ddb846e8593f63920489669f92c8";
logging-data="3649567"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dJV82Oc3fRGXpVPycukFK168mzmehyE4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XHcHRbDU1HNUXT94UnRntu1SxVc=
In-Reply-To: <uvvb42$1kece$7@i2pn2.org>
Content-Language: de-DE
 by: Bonita Montero - Sat, 20 Apr 2024 04:11 UTC

Am 20.04.2024 um 05:00 schrieb Richard Damon:
> On 4/19/24 12:18 AM, Bonita Montero wrote:
>> Am 19.04.2024 um 04:03 schrieb Richard Damon:
>>
>>> How do you "signal" a user-thread without doing a kernel operation
>>> and a thread switch?
>>
>> The signals for the involuntary userspace thread-switch would be sent
>> by a dedicated kernel-thread or by the timer interrupt. This would be
>> more expensive than a thread-switch through the timer interrupt but
>> as voluntary thread-switches have a much higher frequency this would
>> be outweighed.
>
> TO WHAT?
>
> Are you going to reserve a core with a dedicated thread to do this?

A userspace thread is scheduled on a core if there's no other thread
on that core. But if there would be other threads eligible to run on
the core they would be scheduled by a signal in userspace if their
context is also in userspace.

> To "interrupt" a user thread to notify it, you would either need to
> perform a context switch to save the threads previous context or make
> the interrupt non-returnable. If you are going to context switch to the
> notification thread, you might as well switch the the new user-thread
> that you want to go to.

You simply don't understand my idea !

Re: C++20 futex with heavy contention slower than mutex

<B%QUN.9536$moa7.2782@fx18.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!newsfeed.bofh.team!2.eu.feeder.erje.net!feeder.erje.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: C++20 futex with heavy contention slower than mutex
Newsgroups: comp.lang.c++
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org> <uvmpnh$155mq$2@dont-email.me> <uvr67j$295lu$1@raubtier-asyl.eternal-september.org> <uvsjd0$1h01e$2@i2pn2.org> <uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org> <kwuUN.8266$moa7.3858@fx18.iad> <uvtsg1$317v9$1@raubtier-asyl.eternal-september.org> <gvvUN.8268$moa7.5628@fx18.iad> <uvu2qh$32l42$1@raubtier-asyl.eternal-september.org> <6IyUN.532$Xphd.113@fx41.iad> <uvvaeb$3ehhr$1@raubtier-asyl.eternal-september.org>
Lines: 36
Message-ID: <B%QUN.9536$moa7.2782@fx18.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 20 Apr 2024 15:16:49 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 20 Apr 2024 15:16:49 GMT
X-Received-Bytes: 2630
 by: Scott Lurndal - Sat, 20 Apr 2024 15:16 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 19.04.2024 um 20:27 schrieb Scott Lurndal:
>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>> Am 19.04.2024 um 16:48 schrieb Scott Lurndal:
>>>
>>>> Feel free to prototype it using setcontext(2), getcontext(2) and
>>>> makecontext(2).
>>>
>>> I'd need the support of the kernel which should not make context
>>> switches to another thread inside the same process if the thread
>>> is within userspace. And the kernel should have to periodically
>>> inject signals from the timer interrupt to userspace to make it
>>> possible that the userspace-code does the involuntary context
>>> -switch on its own. And I'd need synchronization-primitives like
>>> mutexes and semaphores that would do the otherwise costly context
>>> -switch in userspace; but that's rather easy compared to the kernel
>>> support.
>>
>> https://www.kernel.org/
>>
>> Feel free to modify the kernel to your heart's content.
>
>Seems you don't understand the idead and you think this isn't
>possible.
>

It seems the lack of understanding is on you. Du verstehst es nicht.

"... should not make context switches to another thread inside
the same process if the thread is within userspace".

It seems clear that the thread within userspace is completely
invisible to the kernel, thus it cannot by definition switch to it.

It's not that I don't think it is possible, I just don't think
it provides any measurable benefit for the added complexity.

Re: C++20 futex with heavy contention slower than mutex

<v00ne3$3o4ii$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  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: C++20 futex with heavy contention slower than mutex
Date: Sat, 20 Apr 2024 17:36:35 +0200
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <v00ne3$3o4ii$1@raubtier-asyl.eternal-september.org>
References: <uu6eqs$ab8u$1@raubtier-asyl.eternal-september.org>
<uvmpnh$155mq$2@dont-email.me>
<uvr67j$295lu$1@raubtier-asyl.eternal-september.org>
<uvsjd0$1h01e$2@i2pn2.org>
<uvsra7$2nu4f$1@raubtier-asyl.eternal-september.org>
<kwuUN.8266$moa7.3858@fx18.iad>
<uvtsg1$317v9$1@raubtier-asyl.eternal-september.org>
<gvvUN.8268$moa7.5628@fx18.iad>
<uvu2qh$32l42$1@raubtier-asyl.eternal-september.org>
<6IyUN.532$Xphd.113@fx41.iad>
<uvvaeb$3ehhr$1@raubtier-asyl.eternal-september.org>
<B%QUN.9536$moa7.2782@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 20 Apr 2024 17:36:35 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="14d6ddb846e8593f63920489669f92c8";
logging-data="3936850"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ilr9fEYLcvhGkEQmO54LE9WWc8POwEMU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:37k/1+XBe0oYKztk1rszmWGZWa0=
In-Reply-To: <B%QUN.9536$moa7.2782@fx18.iad>
Content-Language: de-DE
 by: Bonita Montero - Sat, 20 Apr 2024 15:36 UTC

Am 20.04.2024 um 17:16 schrieb Scott Lurndal:

> It seems clear that the thread within userspace is completely
> invisible to the kernel, thus it cannot by definition switch to it.

I'm not talking about userlevel-threads but the state when a thread
is in userspace-state. You lack imagination since you don't understand
my idea.


devel / comp.lang.c++ / Re: C++20 futex with heavy contention slower than mutex

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor