Article View: comp.lang.c
Article #2100Re: Why ordered mutexed don't work ...
From: fir
Date: Wed, 02 Dec 2026 19:06
Date: Wed, 02 Dec 2026 19:06
34 lines
2935 bytes
2935 bytes
Bonita Montero pisze: > 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. Ai says youre konda right here (though she says also Natomiast jeśli chodzi jej o: „wątki zdobywają mutex dokładnie w kolejności, w której zaczęły czekać” to fair/FIFO mutexy jak najbardziej istnieją jako konstrukcje programistyczne. Można taki mechanizm zrobić np. kolejką oczekujących + semaforem/condition variable. ) i personally not code multicore apps now..it makes code uglier so its eventually last step/dirty optimisation and im not at this point but overally is a code that uses mutexes gnerally not wrong.. if i would do i would probbaly use this more based on async/await though for me more nice seem those on async queue manager - or this raw multicore attamps when cpus can ask one another where the second is (those lat ones are my own inventions, so im not sure if they are avaliable)
Technical Details
Message-ID:
<11epq7k$3dlv4$1@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>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: fir <profesor.fir@gmail.com> Newsgroups: comp.lang.c Subject: Re: Why ordered mutexed don't work ... Date: Wed, 2 Dec 2026 20:06:22 +0100 Organization: A noiseless patient Spider Lines: 34 Message-ID: <11epq7k$3dlv4$1@dont-email.me> References: <11ep150$2vi4k$1@raubtier-asyl.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 02 Dec 2026 19:06:29 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3594212"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fD8R1KrOsLjwJFZUVoy2wlAufn8Tgl3w="; posting-host="d8d88b06a7eda50b591c1c8e5ef4a90e" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0 SeaMonkey/2.53.24 Cancel-Lock: sha1:q2KSAO8o2QegyEKl8r1LbCNP3Tk= sha256:uieCBsYBbjqdus3PhbpSyvm1HCkUv1rJ7itcFR04FmE= sha1:m0HTfWPmhkHgStPKHAbVPZhlwOE= sha256:OFM/1n1ljOK9QUsmdKaKyDeOrPvmQn5XPuVmn2kuNeg= In-Reply-To: <11ep150$2vi4k$1@raubtier-asyl.eternal-september.org>