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


Groups > comp.lang.c++ > #113575 > unrolled thread

Run this under Windows and Linux

Started byBonita Montero <Bonita.Montero@gmail.com>
First post2023-10-30 08:12 +0100
Last post2023-11-05 15:30 +0000
Articles 20 on this page of 151 — 7 participants

Back to article view | Back to comp.lang.c++


Contents

  Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-30 08:12 +0100
    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-30 13:08 -0700
      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-31 13:25 +0100
        Re: Run this under Windows and Linux Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-10-31 17:37 +0000
        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-31 13:59 -0700
          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 13:00 +0100
            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 19:24 +0100
              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 19:28 +0100
                Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-01 19:04 +0000
                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 20:11 +0100
                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 13:02 -0700
                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 13:36 +0100
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:13 -0700
                          Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 00:19 -0700
                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:13 +0100
                            Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-04 15:53 +0000
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 16:58 +0100
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 11:44 -0700
                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-09 01:05 -0800
                          Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-04 16:03 +0000
                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 11:45 -0700
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 11:48 -0700
                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 19:58 +0100
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:14 -0700
              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 13:01 -0700
                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 07:10 +0100
              Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-01 20:50 +0000
                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 14:05 -0700
                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 14:07 -0700
              Re: Run this under Windows and Linux Michael S <already5chosen@yahoo.com> - 2023-11-03 16:04 +0200
                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 15:24 +0100
                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:14 -0700
            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 12:58 -0700
              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 07:10 +0100
                Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-02 14:58 +0000
                  Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-02 16:34 +0100
                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 16:46 +0100
                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-02 13:12 -0700
                      Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 10:13 +0100
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:16 -0700
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:33 -0800
                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 16:44 +0100
                    Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-02 16:02 +0000
                      Re: Run this under Windows and Linux Michael S <already5chosen@yahoo.com> - 2023-11-03 16:10 +0200
                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 21:05 -0700
                          Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 04:23 +0000
                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-02 15:37 +0000
                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 16:48 +0100
                    Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-02 16:00 +0000
                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-02 17:26 +0100
                        Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 10:15 +0100
                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 11:55 +0100
                            Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 14:41 +0100
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 15:22 +0100
                                Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 16:35 +0100
                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 16:49 +0100
                                    Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 18:02 +0100
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 18:08 +0100
                                        Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 17:29 +0000
                                        Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 18:52 +0000
                                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:21 -0700
                                        Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-04 17:22 +0100
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 17:35 +0100
                                            Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-04 17:56 +0100
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 18:18 +0100
                                      Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 18:51 +0000
                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:20 -0700
                                    Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 17:28 +0000
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 18:30 +0100
                                        Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 18:03 +0000
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 19:07 +0100
                                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 19:08 +0100
                                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:26 -0700
                                        Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 18:54 +0000
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 20:25 +0100
                                            Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 20:56 +0000
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:15 +0100
                                                Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-04 16:05 +0000
                                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 17:35 +0100
                                                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-04 18:44 +0000
                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:19 -0700
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:16 +0100
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:25 +0100
                                        Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:42 -0700
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 05:33 +0100
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 05:35 +0100
                                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:11 -0800
                                              Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 22:54 +0000
                                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 18:49 -0800
                                                  Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-06 02:58 +0000
                            Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-03 15:32 +0000
                              Re: Run this under Windows and Linux David Brown <david.brown@hesbynett.no> - 2023-11-03 18:05 +0100
                            Re: Run this under Windows and Linux scott@slp53.sl.home (Scott Lurndal) - 2023-11-03 16:53 +0000
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-03 18:09 +0100
                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:25 -0700
                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:17 +0100
                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:44 -0700
                                      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 05:36 +0100
                                        Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 17:25 +0000
                                          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-05 18:55 +0100
                                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:12 -0800
                                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:18 -0800
                                                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 22:55 +0000
                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 18:53 -0800
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 04:44 +0100
                                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 20:10 -0800
                                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 05:16 +0100
                                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:44 -0800
                                                Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-06 04:22 +0000
                                                  Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 05:37 +0100
                                                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:01 -0800
                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:00 -0800
                                                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 09:36 +0100
                                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-06 12:11 -0800
                                                        Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 23:52 +0100
                                                          Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-07 11:51 -0800
                                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 05:15 +0100
                                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:02 -0800
                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 21:05 -0800
                                                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 09:37 +0100
                                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-06 12:13 -0800
                                                        Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-06 23:53 +0100
                                                          Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-06 23:00 +0000
                                                            Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-07 05:36 +0100
                                                              Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-07 05:29 +0000
                                                                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-07 09:38 +0100
                                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-07 11:53 -0800
                                                                    Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-09 05:49 +0100
                                                                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:52 -0800
                                                                        Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-09 05:54 +0100
                                                                          Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:57 -0800
                                                                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-08 20:45 -0800
                                            Re: Run this under Windows and Linux Kaz Kylheku <864-117-4973@kylheku.com> - 2023-11-05 20:53 +0000
                                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-06 12:13 -0800
                              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:24 -0700
                            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-03 15:18 -0700
                              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:18 +0100
                                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:45 -0700
                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-02 13:18 -0700
          Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-01 13:21 +0100
            Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-01 12:59 -0700
              Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 00:01 -0700
              Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:19 +0100
                Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:53 +0100
                Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:51 -0700
                  Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:53 -0700
                    Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-04 12:54 -0700
                      Re: Run this under Windows and Linux "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-11-05 12:15 -0800
    Re: Run this under Windows and Linux Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-11-03 21:18 +0000
      Re: Run this under Windows and Linux Bonita Montero <Bonita.Montero@gmail.com> - 2023-11-04 10:29 +0100
        Re: Run this under Windows and Linux Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-11-05 15:30 +0000

Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →


#117566

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-04 11:45 -0700
Message-ID<ui63ga$3g2ju$2@dont-email.me>
In reply to#117557
On 11/4/2023 9:03 AM, Scott Lurndal wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 11/3/2023 5:36 AM, Bonita Montero wrote:
>>> Am 01.11.2023 um 21:02 schrieb Chris M. Thomasson:
>>>
>>>> If you can avoid using a CAS, aka CMPXCHG over on intel, then do it!
>>>> Although, wrt intel, there is a way to use CMPXCHG without looping.
>>>
>>> I don't believe that, give me some code-example _here_. The expected
>>> value of a compare exchange might always have been asynchronously
>>> changed, so you need looping every time.
>>>
>>>> Think, strong CAS vs weak CAS...
>>>
>>> Strong CAS vs. weak CAS only makes a difference of architectures with
>>> LL/SC. With these architectures a CAS may fail although the actual
>>> data corresponds with the expected value because the cacheline might
>>> have been evicted in the meantime. compare_exchange_strong checks for
>>> this case and loops internally, whereas compare_exchange_weak gives a
>>> false result after one try.
>>
>> Strong CAS cannot fail spuriously. Put on your thinking cap.
>>
> 
> BTW - Compare and Swap was invented by an engineer at IBM -
> CAS is a backronym, the inventors initials are CAS.
> 
> https://www.garlic.com/~lynn/2004l.html#56
> 
> 
>    "charlie had come up with compare and swap at the science scenter
>       http://www.garlic.com/~lynn/subtopic.html#545tech
>     based on a lot of work he was doing in fine grain locking (late 60s)
>     ... and tried to get it into 370 architecture. POK architecture owners
>     came back and said it wasn't possible to justify a multiprocessor-specific
>     instruction for the 370 architecture (already having test&set) ... and that
>     to get it justified, it would be necessary to come up with a non-multiprocessor
>     use for the instruction. thus was born the description for multi-threaded
>     application use in non-locked regions .... when running on either
>     multiprocessor or non-multiprocessor machines. this was originally
>     included in the 370 prinicple of operations as programming notes
>     associated with the compare&swap instruction(s). the description has
>     since been expanded and moved to the principles of operation appendix.
> 
>    note that the choice of compare and swap comes from needing a mnemonic
>    that matched charlie's initials (CAS). the mnemonic was slightly changed
>    for inclusion in 370 to CS (compare and swap) and CDS (compare double and swap).
> 
>    the instructions have since been expanded for 64-bit operation and a
>    new "perform locked operation" has since been added.
> 
> 

Yup. I have actually conversed with Lynn over on comp.arch. Very smart 
person loaded up with knowledge.

[toc] | [prev] | [next] | [standalone]


#117567

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-04 11:48 -0700
Message-ID<ui63lf$3g2ju$3@dont-email.me>
In reply to#117566
On 11/4/2023 11:45 AM, Chris M. Thomasson wrote:
> On 11/4/2023 9:03 AM, Scott Lurndal wrote:
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>> On 11/3/2023 5:36 AM, Bonita Montero wrote:
>>>> Am 01.11.2023 um 21:02 schrieb Chris M. Thomasson:
>>>>
>>>>> If you can avoid using a CAS, aka CMPXCHG over on intel, then do it!
>>>>> Although, wrt intel, there is a way to use CMPXCHG without looping.
>>>>
>>>> I don't believe that, give me some code-example _here_. The expected
>>>> value of a compare exchange might always have been asynchronously
>>>> changed, so you need looping every time.
>>>>
>>>>> Think, strong CAS vs weak CAS...
>>>>
>>>> Strong CAS vs. weak CAS only makes a difference of architectures with
>>>> LL/SC. With these architectures a CAS may fail although the actual
>>>> data corresponds with the expected value because the cacheline might
>>>> have been evicted in the meantime. compare_exchange_strong checks for
>>>> this case and loops internally, whereas compare_exchange_weak gives a
>>>> false result after one try.
>>>
>>> Strong CAS cannot fail spuriously. Put on your thinking cap.
>>>
>>
>> BTW - Compare and Swap was invented by an engineer at IBM -
>> CAS is a backronym, the inventors initials are CAS.
>>
>> https://www.garlic.com/~lynn/2004l.html#56
>>
>>
>>    "charlie had come up with compare and swap at the science scenter
>>       http://www.garlic.com/~lynn/subtopic.html#545tech
>>     based on a lot of work he was doing in fine grain locking (late 60s)
>>     ... and tried to get it into 370 architecture. POK architecture 
>> owners
>>     came back and said it wasn't possible to justify a 
>> multiprocessor-specific
>>     instruction for the 370 architecture (already having test&set) ... 
>> and that
>>     to get it justified, it would be necessary to come up with a 
>> non-multiprocessor
>>     use for the instruction. thus was born the description for 
>> multi-threaded
>>     application use in non-locked regions .... when running on either
>>     multiprocessor or non-multiprocessor machines. this was originally
>>     included in the 370 prinicple of operations as programming notes
>>     associated with the compare&swap instruction(s). the description has
>>     since been expanded and moved to the principles of operation 
>> appendix.
>>
>>    note that the choice of compare and swap comes from needing a mnemonic
>>    that matched charlie's initials (CAS). the mnemonic was slightly 
>> changed
>>    for inclusion in 370 to CS (compare and swap) and CDS (compare 
>> double and swap).
>>
>>    the instructions have since been expanded for 64-bit operation and a
>>    new "perform locked operation" has since been added.
>>
>>
> 
> Yup. I have actually conversed with Lynn over on comp.arch. Very smart 
> person loaded up with knowledge.

The free pool manipulation in IBM's principle of operations, iirc, its 
in an appendix.

[toc] | [prev] | [next] | [standalone]


#117568

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-04 19:58 +0100
Message-ID<ui647q$3gg0d$1@dont-email.me>
In reply to#117557
Am 04.11.2023 um 17:03 schrieb Scott Lurndal:
> BTW - Compare and Swap was invented by an engineer at IBM -
> ...

The idea is not that complex that it would have been invented by
a lot of technichians later. I think that LL/SC is more sexy since
it allows lock-free stacks with one word.

[toc] | [prev] | [next] | [standalone]


#117569

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-04 12:14 -0700
Message-ID<ui6579$3h0fh$1@dont-email.me>
In reply to#117568
On 11/4/2023 11:58 AM, Bonita Montero wrote:
> Am 04.11.2023 um 17:03 schrieb Scott Lurndal:
>> BTW - Compare and Swap was invented by an engineer at IBM -
>> ...
> 
> The idea is not that complex that it would have been invented by
> a lot of technichians later. I think that LL/SC is more sexy since
> it allows lock-free stacks with one word.
> 

Just be careful wrt the reservation granularity. LL/SC can be prone to 
livelock.

[toc] | [prev] | [next] | [standalone]


#117473

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-01 13:01 -0700
Message-ID<uhuaq9$1omhf$6@dont-email.me>
In reply to#117465
On 11/1/2023 11:24 AM, Bonita Montero wrote:
> Am 01.11.2023 um 13:00 schrieb Bonita Montero:
> 
>> I guess he wouldn't have given the benaphore its name because its
>> the simplest form of a mutex and you can find for sure a lot of
>> similar implementations of that on the net.
> 
> I found that the name benaphore was given 1996. Maybe this was the
> first time this idea was published. But this idea is that obvious
> that I had it myself that I think there were several people which
> also had this idea before 1996. A hint on how soon this has been
> invented may be the introduction of the LOCK XADD instruction which
> makes this kind of mutex implementable more efficient than with
> LOCK CMPXCHG because this operation never fails.
> 

Its a semaphore, not a mutex. Any semaphore can be used for a mutex, hint:

Binary Semaphore

[toc] | [prev] | [next] | [standalone]


#117488

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-02 07:10 +0100
Message-ID<uhveg6$22bbn$1@dont-email.me>
In reply to#117473
Am 01.11.2023 um 21:01 schrieb Chris M. Thomasson:
> On 11/1/2023 11:24 AM, Bonita Montero wrote:
>> Am 01.11.2023 um 13:00 schrieb Bonita Montero:
>>
>>> I guess he wouldn't have given the benaphore its name because its
>>> the simplest form of a mutex and you can find for sure a lot of
>>> similar implementations of that on the net.
>>
>> I found that the name benaphore was given 1996. Maybe this was the
>> first time this idea was published. But this idea is that obvious
>> that I had it myself that I think there were several people which
>> also had this idea before 1996. A hint on how soon this has been
>> invented may be the introduction of the LOCK XADD instruction which
>> makes this kind of mutex implementable more efficient than with
>> LOCK CMPXCHG because this operation never fails.
>>
> 
> Its a semaphore, not a mutex. Any semaphore can be used for a mutex, hint:

You can say that each binary semaphore is a mutex. And a semaphore
is usually not a compound of userland and kernel facilities, but a
pure kernel resource.

[toc] | [prev] | [next] | [standalone]


#117478

FromKaz Kylheku <864-117-4973@kylheku.com>
Date2023-11-01 20:50 +0000
Message-ID<20231101134257.167@kylheku.com>
In reply to#117465
On 2023-11-01, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 01.11.2023 um 13:00 schrieb Bonita Montero:
>
>> I guess he wouldn't have given the benaphore its name because its
>> the simplest form of a mutex and you can find for sure a lot of
>> similar implementations of that on the net.
>
> I found that the name benaphore was given 1996. Maybe this was the
> first time this idea was published.

But back then, Ben Affleck had a hotly publicized affair with a hot
water bottle (thermophore), so that's where that's from.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

[toc] | [prev] | [next] | [standalone]


#117479

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-01 14:05 -0700
Message-ID<uhuehv$1pltd$1@dont-email.me>
In reply to#117478
On 11/1/2023 1:50 PM, Kaz Kylheku wrote:
> On 2023-11-01, Bonita Montero <Bonita.Montero@gmail.com> wrote:
>> Am 01.11.2023 um 13:00 schrieb Bonita Montero:
>>
>>> I guess he wouldn't have given the benaphore its name because its
>>> the simplest form of a mutex and you can find for sure a lot of
>>> similar implementations of that on the net.
>>
>> I found that the name benaphore was given 1996. Maybe this was the
>> first time this idea was published.
> 
> But back then, Ben Affleck had a hotly publicized affair with a hot
> water bottle (thermophore), so that's where that's from.
> 

LOL! :^D

[toc] | [prev] | [next] | [standalone]


#117480

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-01 14:07 -0700
Message-ID<uhuemb$1pltd$2@dont-email.me>
In reply to#117478
On 11/1/2023 1:50 PM, Kaz Kylheku wrote:
> On 2023-11-01, Bonita Montero <Bonita.Montero@gmail.com> wrote:
>> Am 01.11.2023 um 13:00 schrieb Bonita Montero:
>>
>>> I guess he wouldn't have given the benaphore its name because its
>>> the simplest form of a mutex and you can find for sure a lot of
>>> similar implementations of that on the net.
>>
>> I found that the name benaphore was given 1996. Maybe this was the
>> first time this idea was published.
> 
> But back then, Ben Affleck had a hotly publicized affair with a hot
> water bottle (thermophore), so that's where that's from.
> 

Be sure to check out:

https://vorbrodt.blog/2019/02/05/fast-semaphore

;^)

[toc] | [prev] | [next] | [standalone]


#117509

FromMichael S <already5chosen@yahoo.com>
Date2023-11-03 16:04 +0200
Message-ID<20231103160428.00007936@yahoo.com>
In reply to#117465
On Wed, 1 Nov 2023 19:24:06 +0100
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> Am 01.11.2023 um 13:00 schrieb Bonita Montero:
> 
> > I guess he wouldn't have given the benaphore its name because its
> > the simplest form of a mutex and you can find for sure a lot of
> > similar implementations of that on the net.  
> 
> I found that the name benaphore was given 1996. Maybe this was the
> first time this idea was published. But this idea is that obvious
> that I had it myself that I think there were several people which
> also had this idea before 1996. A hint on how soon this has been
> invented may be the introduction of the LOCK XADD instruction which
> makes this kind of mutex implementable more efficient than with
> LOCK CMPXCHG because this operation never fails.
> 

Semophores can be efficiently implemented on "old" x86 by means of
'LOCK ADD mem, reg'. It is possible due to arithmetic flags generated
by ADD instructiion. As far as semaphores goes 'LOCK XADD' adds little
or nothing to efficiency over 'LOCK ADD'. XADD is just easier to use as
an intrinsic from C or similar languages.

[toc] | [prev] | [next] | [standalone]


#117512

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-03 15:24 +0100
Message-ID<ui2vqr$2qcrs$2@dont-email.me>
In reply to#117509
Am 03.11.2023 um 15:04 schrieb Michael S:

> Semophores can be efficiently implemented on "old" x86 by means of
> 'LOCK ADD mem, reg'. ...

Semaphores need much more code and this code is usually in the kernel
since with a semaphore a thread may go to sleep or be awakened.

[toc] | [prev] | [next] | [standalone]


#117534

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-03 15:14 -0700
Message-ID<ui3rd0$2vc30$3@dont-email.me>
In reply to#117512
On 11/3/2023 7:24 AM, Bonita Montero wrote:
> Am 03.11.2023 um 15:04 schrieb Michael S:
> 
>> Semophores can be efficiently implemented on "old" x86 by means of
>> 'LOCK ADD mem, reg'. ...
> 
> Semaphores need much more code and this code is usually in the kernel
> since with a semaphore a thread may go to sleep or be awakened.

Huh? A semaphore in userspace is doable. We use a kernel semaphore for 
the slow paths.

[toc] | [prev] | [next] | [standalone]


#117471

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-01 12:58 -0700
Message-ID<uhual7$1omhf$4@dont-email.me>
In reply to#117458
On 11/1/2023 5:00 AM, Bonita Montero wrote:
> Am 31.10.2023 um 21:59 schrieb Chris M. Thomasson:
> 
>> On 10/31/2023 5:25 AM, Bonita Montero wrote:
> 
>>> I think this guy never heard of how a usual mutex works
>>> and re-invented the wheel and called it a benaphore.
> 
>> Why do you say that?
> 
> I guess he wouldn't have given the benaphore its name because its
> the simplest form of a mutex and you can find for sure a lot of
> similar implementations of that on the net.
> 

The benaphore is a semaphore not a mutex! Fwiw, you can use any 
semaphore as a binary semaphore for use as a mutex. Got it?

[toc] | [prev] | [next] | [standalone]


#117489

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-02 07:10 +0100
Message-ID<uhveha$22bbn$2@dont-email.me>
In reply to#117471
Am 01.11.2023 um 20:58 schrieb Chris M. Thomasson:

> The benaphore is a semaphore not a mutex! Fwiw, you can use any 
> semaphore as a binary semaphore for use as a mutex. Got it?

A binary semaphore is also a mutex.

[toc] | [prev] | [next] | [standalone]


#117492

Fromscott@slp53.sl.home (Scott Lurndal)
Date2023-11-02 14:58 +0000
Message-ID<ROO0N.36030$AvZ9.22601@fx35.iad>
In reply to#117489
Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 01.11.2023 um 20:58 schrieb Chris M. Thomasson:
>
>> The benaphore is a semaphore not a mutex! Fwiw, you can use any 
>> semaphore as a binary semaphore for use as a mutex. Got it?
>
>A binary semaphore is also a mutex.

No.  Each is distinct.

It is correct, however, to say that both provide the same functionality.

[toc] | [prev] | [next] | [standalone]


#117493

FromDavid Brown <david.brown@hesbynett.no>
Date2023-11-02 16:34 +0100
Message-ID<ui0fi4$293il$1@dont-email.me>
In reply to#117492
On 02/11/2023 15:58, Scott Lurndal wrote:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 01.11.2023 um 20:58 schrieb Chris M. Thomasson:
>>
>>> The benaphore is a semaphore not a mutex! Fwiw, you can use any
>>> semaphore as a binary semaphore for use as a mutex. Got it?
>>
>> A binary semaphore is also a mutex.
> 
> No.  Each is distinct.
> 
> It is correct, however, to say that both provide the same functionality.
> 

Both provide /similar/ functionality, but not necessarily the same. 
Different OS's differ in the details, but it is common for mutexes to 
have priority boosting if a high priority thread is waiting for a mutex 
currently held by a low priority thread.  Such boosting is normally not 
part of the functionality of a binary semaphore.  This makes them very 
distinctly different on such OS's - a mutex is a lock, a semaphore 
(binary or otherwise) is a signalling mechanism.

(I don't know if Windows makes such a distinction - it's not an OS you 
use when thread or process priority is important.  It is certainly 
common, though not universal, for RTOS's.  And while I don't know the 
details, I'd be surprised if Linux and other *nix's didn't have such a 
distinction.)

[toc] | [prev] | [next] | [standalone]


#117496

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-11-02 16:46 +0100
Message-ID<ui0g88$29990$2@dont-email.me>
In reply to#117493
Am 02.11.2023 um 16:34 schrieb David Brown:

> Both provide /similar/ functionality, but not necessarily the same. 
> Different OS's differ in the details, but it is common for mutexes to 
> have priority boosting if a high priority thread is waiting for a mutex 
> currently held by a low priority thread. Such boosting is normally not 
> part of the functionality of a binary semaphore.  Thismakes them very 
> distinctly different on such OS's - a mutex is a lock, a semaphore 
> (binary or otherwise) is a signalling mechanism.

Does Linux actually boost thread priorities with mutexes ?

[toc] | [prev] | [next] | [standalone]


#117501

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-02 13:12 -0700
Message-ID<ui0vru$2cie9$1@dont-email.me>
In reply to#117493
On 11/2/2023 8:34 AM, David Brown wrote:
> On 02/11/2023 15:58, Scott Lurndal wrote:
>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>> Am 01.11.2023 um 20:58 schrieb Chris M. Thomasson:
>>>
>>>> The benaphore is a semaphore not a mutex! Fwiw, you can use any
>>>> semaphore as a binary semaphore for use as a mutex. Got it?
>>>
>>> A binary semaphore is also a mutex.
>>
>> No.  Each is distinct.
>>
>> It is correct, however, to say that both provide the same functionality.
>>
> 
> Both provide /similar/ functionality, but not necessarily the same. 
> Different OS's differ in the details, but it is common for mutexes to 
> have priority boosting if a high priority thread is waiting for a mutex 
> currently held by a low priority thread.  Such boosting is normally not 
> part of the functionality of a binary semaphore.  This makes them very 
> distinctly different on such OS's - a mutex is a lock, a semaphore 
> (binary or otherwise) is a signalling mechanism.

Right. Basically, any thread/process can increment and/or decrement a 
semaphore. This is different than pure mutex logic. Even if the mutex 
uses a semaphore under the covers...

> 
> (I don't know if Windows makes such a distinction - it's not an OS you 
> use when thread or process priority is important.  It is certainly 
> common, though not universal, for RTOS's.  And while I don't know the 
> details, I'd be surprised if Linux and other *nix's didn't have such a 
> distinction.)
> 

[toc] | [prev] | [next] | [standalone]


#117503

FromDavid Brown <david.brown@hesbynett.no>
Date2023-11-03 10:13 +0100
Message-ID<ui2djl$2ngpf$1@dont-email.me>
In reply to#117501
On 02/11/2023 21:12, Chris M. Thomasson wrote:
> On 11/2/2023 8:34 AM, David Brown wrote:
>> On 02/11/2023 15:58, Scott Lurndal wrote:
>>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>>> Am 01.11.2023 um 20:58 schrieb Chris M. Thomasson:
>>>>
>>>>> The benaphore is a semaphore not a mutex! Fwiw, you can use any
>>>>> semaphore as a binary semaphore for use as a mutex. Got it?
>>>>
>>>> A binary semaphore is also a mutex.
>>>
>>> No.  Each is distinct.
>>>
>>> It is correct, however, to say that both provide the same functionality.
>>>
>>
>> Both provide /similar/ functionality, but not necessarily the same. 
>> Different OS's differ in the details, but it is common for mutexes to 
>> have priority boosting if a high priority thread is waiting for a 
>> mutex currently held by a low priority thread.  Such boosting is 
>> normally not part of the functionality of a binary semaphore.  This 
>> makes them very distinctly different on such OS's - a mutex is a lock, 
>> a semaphore (binary or otherwise) is a signalling mechanism.
> 
> Right. Basically, any thread/process can increment and/or decrement a 
> semaphore. This is different than pure mutex logic. Even if the mutex 
> uses a semaphore under the covers...
> 

That's a very different issue - though of course it is an equally 
important distinction between mutexes and binary semaphores.  (And no, a 
mutex cannot be implemented using semaphores if the mutex has protection 
against priority inversion, and the semaphore does not.)

>>
>> (I don't know if Windows makes such a distinction - it's not an OS you 
>> use when thread or process priority is important.  It is certainly 
>> common, though not universal, for RTOS's.  And while I don't know the 
>> details, I'd be surprised if Linux and other *nix's didn't have such a 
>> distinction.)
>>
> 

[toc] | [prev] | [next] | [standalone]


#117535

From"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Date2023-11-03 15:16 -0700
Message-ID<ui3rfg$2vc30$4@dont-email.me>
In reply to#117503
On 11/3/2023 2:13 AM, David Brown wrote:
> On 02/11/2023 21:12, Chris M. Thomasson wrote:
>> On 11/2/2023 8:34 AM, David Brown wrote:
>>> On 02/11/2023 15:58, Scott Lurndal wrote:
>>>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>>>> Am 01.11.2023 um 20:58 schrieb Chris M. Thomasson:
>>>>>
>>>>>> The benaphore is a semaphore not a mutex! Fwiw, you can use any
>>>>>> semaphore as a binary semaphore for use as a mutex. Got it?
>>>>>
>>>>> A binary semaphore is also a mutex.
>>>>
>>>> No.  Each is distinct.
>>>>
>>>> It is correct, however, to say that both provide the same 
>>>> functionality.
>>>>
>>>
>>> Both provide /similar/ functionality, but not necessarily the same. 
>>> Different OS's differ in the details, but it is common for mutexes to 
>>> have priority boosting if a high priority thread is waiting for a 
>>> mutex currently held by a low priority thread.  Such boosting is 
>>> normally not part of the functionality of a binary semaphore.  This 
>>> makes them very distinctly different on such OS's - a mutex is a 
>>> lock, a semaphore (binary or otherwise) is a signalling mechanism.
>>
>> Right. Basically, any thread/process can increment and/or decrement a 
>> semaphore. This is different than pure mutex logic. Even if the mutex 
>> uses a semaphore under the covers...
>>
> 
> That's a very different issue - though of course it is an equally 
> important distinction between mutexes and binary semaphores.  (And no, a 
> mutex cannot be implemented using semaphores if the mutex has protection 
> against priority inversion, and the semaphore does not.)

Agreed. Basically, the benaphore is a bakery algorithm. It has FIFO on 
the mind... So, you are right.


> 
>>>
>>> (I don't know if Windows makes such a distinction - it's not an OS 
>>> you use when thread or process priority is important.  It is 
>>> certainly common, though not universal, for RTOS's.  And while I 
>>> don't know the details, I'd be surprised if Linux and other *nix's 
>>> didn't have such a distinction.)
>>>
>>
> 

[toc] | [prev] | [next] | [standalone]


Page 2 of 8 — ← Prev page 1 [2] 3 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.c++


csiph-web