Article View: comp.lang.c
Article #2127Re: Why ordered mutexed don't work ...
From: Ross Finlayson
Date: Thu, 03 Dec 2026 07:39
Date: Thu, 03 Dec 2026 07:39
66 lines
4948 bytes
4948 bytes
On 12/02/2026 06:30 PM, Ross Finlayson wrote: > On 12/02/2026 02:13 PM, Chris M. Thomasson wrote: >> On 12/2/2026 10:23 AM, Ross Finlayson wrote: >> [...] >>> I just learned about fast user-space mutex, yet only want the best >>> for my threads, best anti-starvation being fair and a strong semaphore. >> So, well, that answers some of my questions. Those have been around for >> ages. >> >> [...] > > > Thanks for reading. Now please tell me something I don't know. Agreeably > the considerations here about synchronization and contention > and critical transactionality have been over the widely distributed > and the massively parallel instead of the in-memory and in-system, > about the stack of things editing the single value in the giant > data-table of the single-page-app with the single-domain-backend. > > Then, like we were talking about I/O-multiplexing and various > technical considerations, I'd be interested more about the > "conventional wisdom" or "herd instinct" of the lock-multiplexing, > as it were, or single and multiple producers, consumers: and items. > > That's sincerely, if with room for interpretation, I'm looking at in-memory in-system queues and care about knowing things. Here's a good article about memory ordering, "Memory ordering in CPUs". https://fgiesen.wordpress.com/2026/08/25/memory-ordering-in-cpus/ Then, what I'm asking about is like for I/O-multiplexing, basically about the "multiple" side of the producers and consumers, and also the _items_, when for example it makes sense they're interleaved, and when it makes sense they aren't, when producers push a raft or batch of multiple items, or consumers break them off. Not to wade into this "RCU vs. hazard-pointers vs. whatever B. Montero" about various accounts of algorithms for concurrency, one thing I don't see very much is "volatile" instead of "locks" on the reads, then with regards to RCU and figuring out how to change the "root pointer", i.e., that the writer leisurely builds a new state then just swaps the root pointer, and all the readers have that as volatile, then about how to retire/delete the previous state while it's still being iterated over, is simply enough for refcounts, there is though that it's coming out that mfence (or, "memory_order") and compare-and-swap are on quite different orders (of time), then as with regards to alignment and padding (32-bits atomic in 128-bytes cache-line-pairs), that aggressive sorts of spinlocks trash the reorder buffer and also the cache coherency, seems to see a lot more use for "volatile" and compare-and-swap, then refcounts with atomics as the reader co-operation to retire what makes for RCU, meaning publish-protocols like under a volatile pointer with compare-and-swap or like for example how touchfiles as donefiles work on the FS, not that those are on the same orders of time yet it's just an account of atomicity and sequencing, anyways though when studying a bit the circa 2017 state-of-the-art then from a few months ago and some claimed reversals about the results of these sorts approaches, there are many use-cases, then mostly for correctness first (and well-modeled error modes) then for good or excellent performance.
Technical Details
Message-ID:
<UNudnd2Nie5VgYz2nZ2dnZfqn_adnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!local-3.nntp.ord.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<11ep150$2vi4k$1@raubtier-asyl.eternal-september.org> <20261202073550.188@kylheku.com> <lLCdnXR8RdSj_432nZ2dnZfqnPqdnZ2d@giganews.com> <11eq55c$3jdjs$5@dont-email.me> <v56dndhEuvezSY32nZ2dnZfqn_ednZ2d@giganews.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!local-3.nntp.ord.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 03 Dec 2026 07:39:52 +0000 Subject: Re: Why ordered mutexed don't work ... Newsgroups: comp.lang.c References: <11ep150$2vi4k$1@raubtier-asyl.eternal-september.org> <20261202073550.188@kylheku.com> <lLCdnXR8RdSj_432nZ2dnZfqnPqdnZ2d@giganews.com> <11eq55c$3jdjs$5@dont-email.me> <v56dndhEuvezSY32nZ2dnZfqn_ednZ2d@giganews.com> From: Ross Finlayson <ross.a.finlayson@gmail.com> Date: Wed, 2 Dec 2026 23:39:16 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <v56dndhEuvezSY32nZ2dnZfqn_ednZ2d@giganews.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <UNudnd2Nie5VgYz2nZ2dnZfqn_adnZ2d@giganews.com> Lines: 66 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Zfu80aJXVpxZJzctD7nyka4A+3xSanNJwXMSD8bsCLO3vtRdP9v0bEN2uYhbDYazT9xntWwEHZ6kY0a!KxSJRKGDLp2etX/nZiOZmdLeyOZQa3AeM2e7Rtrg8ah68GgUyMD1mtphycyGX4/VDqmTrWo3i1+t X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40