#Queue

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-06-13

The #lockfree command #queue in #poser (for #swad) is finally fixed!

The original algorithm from [MS96] works fine *only* if the "free" function has some "magic" in place to defer freeing the object until no thread holds a reference any more ... and that magic is, well, left as an exercise to the reader. 🙈

Doing more research, I found a few suggestions how to do that "magic", including for example #hazardpointers ... but they're known to cause quite some runtime overhead, so not really an option. I decided to implement some "shared object manager" based on the ideas from [WICBS18], which is kind of a "manually triggered garbage collector" in the end. And hey, it works! 🥳
github.com/Zirias/poser/blob/m

[MS96] dl.acm.org/doi/10.1145/248052.
[WICBS18] cs.rochester.edu/u/scott/paper

#coding #c #c11 #atomics

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-06-11

This redesign of #poser (for #swad) to offer a "multi-reactor" (with multiple #threads running each their own event loop) starts to give me severe headaches.

There is *still* a very rare data #race in the #lockfree #queue. I *think* I can spot it in the pseudo code from the paper I used[1], see screenshot. Have a look at lines E7 and E8. Suppose the thread executing this is suspended after E7 for a "very long time". Now, some dequeue operation from some other thread will eventually dequeue whatever "Q->Tail" was pointing to, and then free it after consumption. Our poor thread resumes, checks the pointer already read in E6 for NULL successfully, and then tries a CAS on tail->next in E9, which is unfortunately inside an object that doesn't exist any more .... If the CAS succeeds because at this memory location happens to be "zero" bytes, we corrupted some random other object that might now reside there. 🤯

Please tell me whether I have an error in my thinking here. Can it be ....? 🤔

Meanwhile, after fixing and improving lots of things, I checked the alternative implementation using #mutexes again, and surprise: Although it's still a bit slower, the difference is now very very small. And it has the clear advantage that it never crashes. 🙈 I'm seriously considering to drop all the lock-free #atomics stuff again and just go with mutexes.

[1] dl.acm.org/doi/10.1145/248052.

Pseudo-code of a lockfree enqueue operation
Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-06-11

I guess this funny looking graph showing response time percentiles is exactly the result of one of 8 service worker threads having a lot more to do than all others. I wonder whether this could be a behavioral artifact of the #lockfree #queue used to distribute the accepted connections. 🤔

La Gay Lifelagaylife
2025-06-11

Vidéo - Un mec est allongé nu sur le lit d'examen et attend le docteur. Le docteur arrive et commence à doucement lui toucher la . A lire ici --> wp.me/pbyKZP-1b86

Nick DeWolf Photo Archivenickdewolfphoto@pixelfed.social
2025-06-08
london, england
may 1959

black cabs

https://www.flickr.com/photos/dboo/52054934634
https://www.flickr.com/photos/dboo/6967507385/

part of an archival project, featuring the photographs of nick dewolf

© the Nick DeWolf Foundation
Image-use requests are welcome via nickdewolfphotoarchive [at] gmail [dot] com

#photography #film #blackandwhite #bw #london #england #blackcabs #hackneycarriages #cabs #taxis #cars #queue #1950s
Nick DeWolf Photo Archivenickdewolfphoto@photog.social
2025-06-08

london, england
may 1959

black cabs

flickr.com/photos/dboo/5205493
flickr.com/photos/dboo/6967507

part of an archival project, featuring the photographs of nick dewolf

© the Nick DeWolf Foundation
Image-use requests are welcome via nickdewolfphotoarchive [at] gmail [dot] com

#photography #film #blackandwhite #bw #london #england #blackcabs #hackneycarriages #cabs #taxis #cars #queue #1950s

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-06-04

I now experimented with different ideas how to implement the #lockfree #queue for multiple producers and multiple consumers. Unsurprisingly, some ideas just didn't work. One deadlocked (okaaay ... so it wasn't lockfree) and I eventually gave up trying to understand why.

The "winner" so far is only "almost lockfree", but at least slightly improves performance. Throughput is the same as with the simple locked variant, but average response times are 10 to 20% quicker (although they deviate stronger for whatever reason). Well, that's committed for now:

github.com/Zirias/poser/commit

#C11 #atomics

2025-05-19

Not a criticism of the staff but today I've spent 4 hours in telephone queues to 3 different Council departments. I've only resolved 1 issue 😞

#CountyCouncil #telephone #queue

La Gay Lifelagaylife
2025-05-13

Vidéo - Un mec est allongé nu sur le lit d'examen et attend le docteur. Le docteur arrive et commence à doucement lui toucher la . A lire ici --> wp.me/pbyKZP-1b86

Karl NudeAnpass
2025-05-10
Gizchina.com | Tech news, reviews, how to's, guides and moregizchina.com@web.brid.gy
2025-05-08
2025-04-22

Über #Schwarz ist viel zu erzählen; aber als die Architekten anfingen, alle Schwarz zu tragen, wie hier erzählt, hatte ich es aufgehört.
Als Nuance von #Grau kann ich es noch sehr gut unterbringen. Aber erstmal hab ich noch immer einen Aufsatz zu #Rosa im #Queue ,Warteschleife.
Bislang hören wir noch was über Einkaufswagen.

deutschlandfunk.de/zwischen-ko

#dlf

Flowblade offers a dedicated Batch Render Queue application. Batch Render Queue is a separate application to Flowblade and runs on a different process, so it is possible to close Flowblade without affecting ongoing renders.

jliljebl.github.io/flowblade/w

#Linux #Flowblade #video #editor #batch #render #queue

The FLOWBLADE 2.20 logo on a white background.
2025-03-21
2025-03-17

But wait, there's more... The queue continued Kasprowy Wierch, Tatras, Poland #photography #street #landscape #queue #tatra

The reverse view of the previous shot, showing the queue continuing up the hill to the cable car station, with railed-in pens holding another fifty or sixty people.
2025-03-17

Climb Every Mountain 🎶 ...the queue for the cable car is too #crowded (pro tip: go early) Kasprowy Wierch, Tatras, Poland #photography #street #landscape #queue #tatra #MarchIntoLandscapes #crowded #AlphabetChallenge #WeekLforLyrics #EastCoastKin #PhotographersUnited

A very long queue several people wide completely fills the long stair entry to the Kasprowy Wierch cable car station. There are at least a hundred people queued, stretching down the street from the bottom of the stairs, and there are more further uphill out of shot.
2025-03-16

There are Brits standing in queue to return their beers.
Flat caps all.
#Beer #Pub #Queue

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst