Article View: comp.lang.c
Article #2111Re: Why ordered mutexed don't work ...
From: Chris M. Thomasson
Date: Wed, 02 Dec 2026 22:09
Date: Wed, 02 Dec 2026 22:09
31 lines
2854 bytes
2854 bytes
On 12/2/2026 4:47 AM, David Brown wrote: > On 02/12/2026 12:58, Bonita Montero wrote: >> Just for fun, I tried writing a mutex today that wakes up threads >> in the same order they began waiting. I thought I was finished, but >> while cycling into the old town for a meal, it occurred to me: I can >> control the order in which threads start waiting, but I cannot control >> the order in which the scheduler wakes them up. Furthermore, if there >> isn’t a free CPU core available, there’s no guarantee that a thread >> will be woken up immediately. Once I got home, well-fed, I deleted >> the entire project. >> In any case, no operating system offers such mutexes, and runtime >> environments don’t provide them either. I suspect I’m not the first >> person to come up with this idea. > > I find it impressive that you know such details about the many hundreds > or thousands of operating systems that exist, including all proprietary > ones that are only known within a single company. Or by "no OS", did > you mean Windows doesn't document such behaviour, and that's all the > checking you need to claim it is universal? > > Resuming the blocked threads in FIFO order of blocking is the norm in > RTOS's, and is typically guaranteed by the OS. Perhaps he has SCHED_OTHER on the mind? ;^) > Which resumed thread is > scheduled to run then depends on the priorities of all runable threads > (including the one that just release the mutex, as it is still runable). >
Technical Details
Message-ID:
<11eq4ul$3jdjs$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11ep150$2vi4k$1@raubtier-asyl.eternal-september.org> <11ep418$3150m$1@dont-email.me>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!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: Why ordered mutexed don't work ... Date: Wed, 2 Dec 2026 14:09:24 -0800 Organization: A noiseless patient Spider Lines: 31 Message-ID: <11eq4ul$3jdjs$2@dont-email.me> References: <11ep150$2vi4k$1@raubtier-asyl.eternal-september.org> <11ep418$3150m$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 02 Dec 2026 22:09:25 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3782268"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MA6z+EhVLfHn3UMYlCCDo+/rNOuwMHuA="; posting-host="893826ed375ffe79bd897ea0a9456029" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:1cMes/MwszMGGuKUrrUqBnwWKCo= sha256:gHBXdAZ5oIEk9e8B3kfUJPMAN56jyrP16yy7xsQ2WHg= sha1:DnT01KBYuL+FI4JUWFuuOnAUXxc= sha256:L0xe+YaGMurloh4+O8Y5fw9Pxlr/693tGJzVUjMzn9w= In-Reply-To: <11ep418$3150m$1@dont-email.me> Content-Language: en-US