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


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

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

From Richard Damon <richard@damon-family.org>
Newsgroups comp.lang.c++
Subject Re: C++20 futex with heavy contention slower than mutex
Date 2024-04-19 23:00 -0400
Organization i2pn2 (i2pn.org)
Message-ID <uvvb42$1kece$7@i2pn2.org> (permalink)
References (18 earlier) <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>

Show all headers | View raw


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.

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


Thread

C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-29 14:14 +0100
  Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-29 15:28 -0700
    Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-29 15:30 -0700
      Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-29 16:29 -0700
        Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-29 19:46 -0700
        Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-30 09:25 +0100
          Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-30 11:51 -0700
            Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-30 12:02 -0700
            Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-30 21:18 +0100
              Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-31 13:11 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-01 08:32 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-31 23:40 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-01 10:57 +0200
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-01 11:01 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-01 12:27 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-02 04:37 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-12 14:16 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-13 03:00 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 12:26 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 06:19 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 21:26 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 06:30 +0200
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 06:34 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 22:21 -0700
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 22:21 -0700
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 22:22 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 07:30 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 22:32 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 07:36 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 22:42 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 07:46 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 22:48 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 11:25 +0200
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 15:12 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-14 12:02 -0700
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-14 12:06 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-14 22:57 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-14 20:23 -0700
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-14 20:26 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-15 06:15 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-14 22:03 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-15 08:20 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-15 12:08 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-16 06:32 +0200
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-16 11:31 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-16 14:07 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-17 10:24 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-17 11:48 -0700
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-17 11:52 -0700
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-16 14:14 -0700
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-18 15:12 +0200
                Re: C++20 futex with heavy contention slower than mutex Richard Damon <richard@damon-family.org> - 2024-04-18 22:03 -0400
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-19 06:18 +0200
                Re: C++20 futex with heavy contention slower than mutex scott@slp53.sl.home (Scott Lurndal) - 2024-04-19 13:41 +0000
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-19 15:44 +0200
                Re: C++20 futex with heavy contention slower than mutex scott@slp53.sl.home (Scott Lurndal) - 2024-04-19 14:48 +0000
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-19 17:32 +0200
                Re: C++20 futex with heavy contention slower than mutex scott@slp53.sl.home (Scott Lurndal) - 2024-04-19 18:27 +0000
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-20 04:48 +0200
                Re: C++20 futex with heavy contention slower than mutex scott@slp53.sl.home (Scott Lurndal) - 2024-04-20 15:16 +0000
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-20 17:36 +0200
                Re: C++20 futex with heavy contention slower than mutex Richard Damon <richard@damon-family.org> - 2024-04-19 23:00 -0400
                Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-04-20 06:11 +0200
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-14 12:10 -0700
                Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-13 22:46 -0700
            Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-31 22:01 -0700
              Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-31 22:02 -0700
    Re: C++20 futex with heavy contention slower than mutex Bonita Montero <Bonita.Montero@gmail.com> - 2024-03-30 05:18 +0100
  Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-30 12:00 -0700
  Re: C++20 futex with heavy contention slower than mutex Michael S <already5chosen@yahoo.com> - 2024-04-01 12:18 +0300
    Re: C++20 futex with heavy contention slower than mutex "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-04 19:56 -0700

csiph-web