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


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

Re: A thread-queue

From scott@slp53.sl.home (Scott Lurndal)
Subject Re: A thread-queue
Newsgroups comp.lang.c++
References (3 earlier) <t6o2ah$iau$1@dont-email.me> <t6po8o$h1t$1@dont-email.me> <t6q5sv$3q2$1@dont-email.me> <t6qg25$8j6$1@dont-email.me> <t6rf6l$em1$1@dont-email.me>
Message-ID <ULbkK.29059$IgSc.7575@fx45.iad> (permalink)
Organization UsenetServer - www.usenetserver.com
Date 2022-05-27 21:53 +0000

Show all headers | View raw


"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>On 5/27/2022 5:26 AM, Bonita Montero wrote:
>> On one side the situation Chis and others are afraid of doesn't
>> actually happen. On the other side _copying_ the contents of a
>> thread queue without consuming them isn't a requirement to a
>> thread queue. So I removed the copy-constructor and left the
>> move constructor which does everthing that's needed.
>
>Okay. However, it still makes me a bit nervous when I see code acquiring 
>more than one lock at a time. I have had some horror shows trying to 
>debug code written by others... One of the authors said, no need to 
>worry because the locks are recursive (yuck) without a care in the world 
>about lock ordering... Argh!

Back in the early 1980s we were updating the architecture
of the Burroughs B3500/B4700/B4900 to support SMP and a larger
physical memory space.   One of the features added to support
SMP was hardware instructions providing capabilities similar to mutexes and posix
condition variables.

To prevent deadlock, every lock has a 'canonical lock number' (CLN) that
ranges from 1 to 9999.  The hardware will not allow the LOCK
instruction to complete successfully if there has already
been a lock acquired with a equal or higher CLN; the instruction
will fault instead.   Likewise the UNLK instruction would fault
of the lock was equal to the highest CLN stored in the hardware
task data structure.

This prevented A-B deadlocks, circular
locking paths and out-of-order unlocks.

Similarly, the 'event' instruction provided wait, signal and
broadcast variants.

As all these instructions were used by the kernel (MCP) as well
as user-mode applications, there was a microkernel that handled
thread (task) scheduling.  MCP functions were always invoked on
behalf of either a user task or an operating system Independent
Runner (modern thread), and the microkernel would handle scheduling
for LOCK/UNLK events and WAIT/CAUS instructions.

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


Thread

A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-24 04:07 +0200
  Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-25 13:58 -0700
    Re: A thread-queue Bo Persson <bo@bo-persson.se> - 2022-05-26 01:04 +0200
      Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-25 20:58 -0700
      Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-26 16:20 +0200
        Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-26 22:40 -0700
          Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-27 11:33 +0200
            Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-27 14:26 +0200
              Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 14:18 -0700
                Re: A thread-queue scott@slp53.sl.home (Scott Lurndal) - 2022-05-27 21:53 +0000
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 15:43 -0700
                Re: A thread-queue scott@slp53.sl.home (Scott Lurndal) - 2022-05-28 14:51 +0000
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 18:24 -0700
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-27 18:26 -0700
                Re: A thread-queue scott@slp53.sl.home (Scott Lurndal) - 2022-05-28 14:56 +0000
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-28 16:49 -0700
                Re: A thread-queue red floyd <no.spam.here@its.invalid> - 2022-05-28 17:16 -0700
                Re: A thread-queue "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2022-05-30 16:00 -0700
                Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-28 07:16 +0200
    Re: A thread-queue Bonita Montero <Bonita.Montero@gmail.com> - 2022-05-26 16:15 +0200

csiph-web