The Santa Claus Problem - Thread Synchronization
Loading...
2,382
Loading...
Uploader Comments (kjlg74)
see all
All Comments (34)
-
That's how I would like my classes to be: simple and interesting. I finally understood semaphores, so thank you for that! :)
-
Just 1 question: Why mutex for counters? What would happen if there were not mutex for counter access??
-
@Wysiwygnuttyjo51 Oh no, nothing like that. When I talked about Santa "sleeping", I just forgot to mention who with ;P
-
@Dullbedsitblogger If even a non-programmer can get something from this, I must be doing something right.
I should get my students drunk next time I teach this - maybe it helps! :D
Loading...
I took a programming class in highschool, so im glad I can understand some 60% of this, interesting stuff.
You keep making good vids, but I keep slacking on the one I wanted to do. I already made a real-life 3-D version of the evolved virtual worm like 2 months ago! I just dont know were to start with the video editing. Should I play music? Should I get a mic and voice over?(rhetorical). I want to finish it sometime soon.
tostrong4you 1 year ago
@tostrong4you Thanks a lot!
60% sounds about right. I don't imagine a high school programming class discusses thread synchronization - so the mutex and semaphore stuff probably seemed a little odd.
You built a 3D model of the end-over-end worm?! That's pretty AWESOME :D
I can't wait to see that! Very cool!
kjlg74 1 year ago
I'm fairly weak on programming, what are semaphore mutex variable types? or are those something specific to the function?
Zetimenvec 1 year ago
@Zetimenvec Even if you were a strong programmer, you'd never encounter mutexes and semaphores outside of thread synchronization - and even then, there are other synchronization mechanisms one might use instead.
You can think of a semaphore as a special kind of integer. The only thing you can do with it is increment it or decrement it (you can't even look inside to see its current value). If you decrement it and the result is negative, you (the thread) block. (continued)
kjlg74 1 year ago
@kjlg74 ..and if you increment it while there are thread(s) blocked on it, one of those threads will be unblocked and allowed to continue running.
Decrementing is often called "waiting" because you might block, and incrementing is often called "signaling".
A mutex is really just a semaphore with a maximum positive value of 1
It's too much to explain in YT comments, but it's quite interesting stuff. Check out the PDF Downey book (see video desc). I highly recommend it :)
kjlg74 1 year ago
@kjlg74 Some languages actually have semaphores as built-in primitive data types. Java has them, but you need to import them from java.util.concurrent
kjlg74 1 year ago