Linus Torvalds on semaphores (1999)
yarchive.net
Linus Torvalds on semaphores (1999)
1–10 of 112 posts
Re: Linus Torvalds on semaphores (1999)
#2Maybe you can edit the title and add a little [199] :-)
Re: Linus Torvalds on semaphores (1999)
#3Quotes like this are why I always read what Linus has to say, regardless of whether the subject is relevant to my life in the slightest.
Edit: Yes people, those Dutch words exist! I get it! I'm sure Linus was well aware of that when he made this remark. However, the point Linus was making (in a humorous way) was that like most computer scientists / mathematicians, Dijkstra was overly fond of obscure, single-letter names, which nobody ever intuitively understands. Whereas the names "up" and "down" (see the rest of Linus' quote) are far more intuitive. Personally, I would argue that "hold" and "release" convey the intent in a clearer, more abstract way.
Re: Linus Torvalds on semaphores (1999)
#4Re: Linus Torvalds on semaphores (1999)
#5Linus is the BDFL of the Linux kernel, and he obviously needs to think about the big picture. And yet in these comments he gets into nitty-gritty assembly language.
I love it when a big picture guy also sweats the details.
Re: Linus Torvalds on semaphores (1999)
#6it's surprising that Linus answers peacefully and pedagogically ! and thus it's a nice read to refresh the definition of semaphores, spinlocks and mutexes. Maybe you can edit the title and add a little [199] :-)
Re: Linus Torvalds on semaphores (1999)
#7Re: Linus Torvalds on semaphores (1999)
#8it's surprising that Linus answers peacefully and pedagogically ! and thus it's a nice read to refresh the definition of semaphores, spinlocks and mutexes. Maybe you can edit the title and add a little [199] :-)
Re: Linus Torvalds on semaphores (1999)
#9it's surprising that Linus answers peacefully and pedagogically ! and thus it's a nice read to refresh the definition of semaphores, spinlocks and mutexes. Maybe you can edit the title and add a little [199] :-)
He did start out by saying Peter Samuelson's CS education was bad, so there was certainly some of the infamous Linus in there.
Re: Linus Torvalds on semaphores (1999)
#10http://www.cs.utexas.edu/users/EWD/transcriptions/EWD00xx/EW...
Here is a implementation of P and V, the original counted semaphore primitives, from 1972.
http://www.fourmilab.ch/documents/univac/fang/
This is UNIVAC 1108 assembly code. Along with P and V is the code for bounded buffers, with the operations "PUT" and "GET". Bounded buffers are what Go calls "channels". Note how simple they are if you have P and V. That code even works on multiprocessors. There's one semaphore for "queue full" and one for "queue empty". PUT does a P on "queue full", puts on an item, and does a V on "queue empty". GET does a P on "queue empty", takes off an item, and does a V on "queue full". It's very simple. That's the real use case for P and V. Linus' note indicates that in 1999 he didn't know this.
(I didn't write those primitives, but I've used that code, and once ported it to a Pascal compiler I adapted to handle concurrency.)
This stuff was all well understood four decades ago. Much of it was forgotten outside the mainframe world, because threads and multiprocessors didn't make it to microprocessors for several more decades. UNIX, for a long time, had very primitive synchronization primitives. Early UNIX didn't have threads, and even after it got threads, it took years before the locking primitives settled down. The DOS/Windows world didn't get them until Windows NT, circa 1993.
It's been amusing to me to see bounded buffers resurface in Go. They're quite useful, and I've been using them in concurrent programs for many years.