The format of this is the most funny to me, that the son would ask his (presumably non-technical) dad about this topic, and the dad is just bewildered, and the son asks again, but in Reddit lingo, and then the dad answers in perfect layman’s terms. Just altogether surreal
I remember my first semaphore. It was before async was a thing and I needed to wait on 3 network calls to finish. I had each call make a callback with an identifier. Each time the function was called, it checked if every expected identifier had completed, proceeding only after that was the case.
I had a similar approach to my first time working with threads. Instead of worrying about locking 1 memory spot for them to take turns editing, I gave each thread a dedicated memory spot to write their results and then aggregated the results when they all finished.
I guess nowadays I would just use a channel or mutex depending on what I needed to do.
I love the name C# gave it. “SemaphoreSlim.” Sounds like a rapper or something lol.
Will the real Slim Semaphore please sync up
We're gonna have a deadlock here
The real slim semaphore please stand up
Nothing you just posted has to do with a semaphore lol...
After googling the definition that is true. I used the semaphore mechanisms to do things other than manage access to a singular resource. Is there a precise term for that part of it?
sounds somewhat like a barrier? tho barriers are used for syncing up different threads / tasks a callback-based barrier would be something like that
Wouldn't TaskCompletionSource also work?
Worth using in an interview.
It only dawned on me yesterday that mutex is short for MUTually EXclusive (resource access). Don’t know if i am the only one that did not realize.
Downvoted because incorrect meme format.
Upvoted because correct comment
Race condition
Semaphore is just a list of Mutex then?
The metaphor doesn't work so well imo as the difference is that with Mutex the thread has full ownership on the lock and directly releases it (locked toilet works fine here), while semaphore allows the thread to "signal" it's finished but it does not necessarily ends the wait of another thread, that's up to the semaphore implementation.
Metaphor would work better if urinals were managed by a janitor responsible to allow access. When you're done you tell him, and then it's up to him to decide if someone else can enter. He can be conservative and only let 50% urinals used at once, he can be stupid and let too many people enter and piss on each other too.
Not quite. A mutex is a semaphore with a capacity of 1, but semaphores allow for unbounded releases and acquires, or they can start with a capacity of 0 and act like a one-time event.
Semaphores are usually made up of an atomic counter (the number of keys in the bucket) and a conditional variable (to wake up threads who are waiting to acquire the semaphore).
Some implementations also attach "ownership" semantics to a mutex so it can only be unlocked by the thread that originally locked it, making it subtly distinct from a semaphore with capacity of 1, but I don't think this was part of the original definition
Do context next please
Anyone has a gender neutral explanation?
They said “urinals”, not “men’s bathroom”.
It already was gender neutral.
Probably wanted something along the lines of Urinals<T>?
Women don't get to see urinals in their bathrooms. Maybe that is their gripe.
It's the same thing with having a sink in the toilet stall vs having sinks in front of a mirror and no individual sink, though.
Wow, its been years since i saw this meme format
I posted a meme with this template 4 years ago and got this comment. Really how old is this template? lol.
I saw one joke where the boy rushes in, yelling he can't find mom.
Cue to the dad section: That yellow page (changes to the yellow hair of a woman)
He replies back, well she isn't here either.
I remember seeing that one. It was hilarious af
rare form where the description is funnier then the meme itself
Based on my reaaally long term memory... At least 15-17 years old
2009, so pretty much accurate.
I’ve seen this clear back to 2012, and it predates even that. It’s old, alright!
Early 2000s, so at least a decade maybe 2
Like, 15yrs.
Almost 15 years, I remember this one from 2010.
it just occurred to me that i never saw the orignal comic.
so i looked it up and here it is
Well. There’s that….
I much prefer this version
Well played sir. Very well played
And I have maybe never seen it being used so wrong lol