#Threading
Explore tagged Tumblr posts
Text
Let's Talk Locks (and Chopsticks!): Diving into the Dining Philosophers Problem
Heyyyy,
So, I'm super excited to start diving into some classic computer science concepts here, especially those that pop up in the world of Linux and concurrent programming. And what better place to start than with the fascinating (and sometimes frustrating!) Dining Philosophers Problem (I learned it about two days ago so please be patient :P).
Think about it: a group of philosophers are sitting around a circular table. In front of each philosopher is a bowl of delicious spaghetti. To eat (somehow) a philosopher needs two chopsticks – one to their left and one to their right. However, there's only one chopstick between each pair of philosophers.
The philosophers have a simple life cycle: they think, they get hungry, they try to pick up their chopsticks, they eat, and then they put the chopsticks down and go back to thinking.
The tricky part arises when multiple philosophers get hungry at the same time. If everyone picks up their left chopstick simultaneously, no one can pick up their right chopstick! They all end up waiting indefinitely, holding one chopstick and starving. This, my friends, is a classic example of a deadlock (and I'm not talking about Valorant's agent ;) ).
Now, why is this relevant to Linux and programming?
Well, the Dining Philosophers Problem is a great analogy for common issues we face when dealing with concurrent processes or threads that need to access shared resources (like those chopsticks!). Chopsticks represent shared resources: Think of these as locks, mutexes, semaphores, or any other mechanism used to control access to critical sections of code (I'm going to talk about those in another posts). Philosophers represent processes or threads: These are the independent units of execution trying to use the shared resources.
The act of picking up chopsticks represents acquiring locks: A process needs to acquire the necessary locks before it can proceed with its task (eating). Deadlock in the problem mirrors deadlock in programs: Just like the philosophers can get stuck waiting for each other's chopsticks, threads can get stuck waiting for locks held by other threads, leading to a program freeze (don't try it at home).
There are several interesting ways to approach solving the Dining Philosophers Problem (and preventing deadlocks in our programs!). Some common strategies include: Introducing a resource hierarchy: Making philosophers pick up chopsticks in a specific order. Allowing a philosopher to pick up both chopsticks only if both are available. Introducing a central coordinator. Limiting the number of philosophers trying to eat at the same time.
What are your initial thoughts on the Dining Philosophers Problem?
Have you encountered similar deadlock situations in your own programming projects? Let me know!
I'm planning on diving deeper into some of the solutions in future posts ;)
6 notes
·
View notes
Text
I tried a more complicated pattern and uuuuuh

It looks like something alright...
But that's OK. Things you craft don't have to be perfect, especially if you're doing it for the first time. Be proud of trying something new.
#handmade#threading#brazilian bracelets#bracelets#handmade bracelets#post#progress#it's OK if it's not perfect
3 notes
·
View notes
Text
🫐
Kirsten Chursinoff
A selection of berry-themed textile art. Free-motion machine quilting and hand embroidery, using some quilting and applique techniques.
16K notes
·
View notes
Text

This is the best idea in the history of film.
#also Taika should direct it#Aubrey plaza#patti lupone#muppets#miss piggy#Pedro pascal#agatha all along#jennifer coolidge#threads#meta
166K notes
·
View notes
Text
44K notes
·
View notes
Text

#conclave#pope#jobs#work#threads#twitter#tweets#tweet#memes#meme#funny#lol#lmao#humor#mostly-funnytwittertweets
42K notes
·
View notes
Text
#class– would erik use reddit? let's discuss#phantom of the opera#poto#poto shitpost#okay but imagine the paris opera house subreddit#there being a pinned thread dedicated to opera ghost sightings#erik having mod access for some reason#(the managers keep trying to ban him but he only stays gone for like 2 days before reappearing somehow)#the ballet girls using burner accounts to spread rumors#someone posts that they saw the vicomte go to christine's dressing room like it's deuxmoi#erik fully just doxxes them in the comments
53K notes
·
View notes
Text

47K notes
·
View notes
Text
Nice people make the best Nazis. Be mean, be tough, have a fascist tooth/skull collection.
28K notes
·
View notes
Text
"Absolutely no one comes to save us but us."
Ismatu Gwendolyn, "you've been traumatized into hating reading (and it makes you easier to oppress)", from Threadings, on Substack [ID'd]
#q#lit#quotes#typography#essays and articles#id included#ismatu gwendolyn#youve been traumatized into hating reading and it makes you easier to oppress#threadings#m#x
200K notes
·
View notes
Text

And the best reply:

[Source 1] [Source 2]
Edited to add:

[Source]
31K notes
·
View notes
Text
Hey, if you do crafts (especially things like crochet, knitting, embroidery, etc), make sure to look up how to identify when a listing is AI generated. You do NOT want to waste money on an incredible looking kit or pattern that is physically impossible to make, especially if you're on sites like etsy hoping to support an actual artist.
#as an embroiderer: big red flags are curved straight or satin stitches#stitches that you cannot identify or figure out at all#thread that fades into other colors#backgrounds that match the piece weirdly well (like a floral embroidery piece with a matching vase and flowers on the table)#and a lack of videos of the piece and photos from other angles
28K notes
·
View notes
Text
Ok so I tried it with thicker thread and omg this thing looks as if it's going to last me 5 generations what the hell

#yes that's positive#I love it#brazilian bracelets#threading#handmade#handmade bracelet#post#I can't stop making those#feels like one sturdy bitch
3 notes
·
View notes
Text
Mc in Lingeries, Li addition
#i did it!#its from a twt thread i decided to draw#my art#Chubby mc#doodle#lads#lnds#l&ds#doodle dump#loveanddeepspace#love and deepspace#xavier#zayne#rafayel#sylus#caleb#lads xavier#lads zayne#lads rafayel#lads sylus#lads caleb#xavier x reader#zayne x reader#rafayel x reader#sylus x reader#caleb x reader#love and deepspace xavier#love and deepspace zayne#love and deepspace rafayel#love and deepspace sylus
14K notes
·
View notes