Hacker News new | ask | show | jobs
by simias 2363 days ago
>The main use of spinlocks that i'm aware of is minimising latency in inter-processor communication.

The main use of spinlocks that I'm aware of is dealing with interrupt handlers in driver code. In this situation you generally can't go to sleep (sleeping with interrupts disabled is generally a good way of never waking up) so calling "mutex_lock" is simply out of the question. That's probably a niche use but that's literally the only situation I've ever used actual spin locks instead of mutexes, mainly for the reasons outlined by TFA.

4 comments

I did some algorithmic/ high frequency trading and we were only spinning waiting for task and never, ever releasing to OS. But then the entire server was dedicated to one job and the job consisted of reacting to single stream of messages.

Most of the time I would say if lock performance impacts your application you are likely doing something wrong. There are many ways of solving typical synchronization problems without locks and if you need locks there are many ways to amortize costs.

Mutexes are not faster than spin locks the same way slower cars are not faster than fast cars. You might still crash in a fast car and be slower to the end of the race (to the supermarket) but that is just your failure to use the power you were given responsibly.

TFA? Tried to google but unsuccessful
I've seen lots of valid variants, including and probably not limited to:

The feature article ; the freaking article ; the friendly article ; the f$%^&*( article, c.f. RTFM.

I personally go with "The Fine Article" in my mind when I write it, although obviously all these alternatives are possible. I first encountered this initialism on slashdot back when it was still relevant, although I don't know if it was coined there.

And yeah, I believe that it derives from "RTFA" (read the fucking article) which would be what you told people who obviously commented without reading the article.

Not sure it’s the origin, but it used to be RTFM (read the fucking manual).
RTFM has been mostly superseded by LMGTFY.
Also read "read the fine manual"
The original, as documented in the hacker dictionary, is of course RTFM (read the f...ine manual).
The (Fuc|Frea)king Article. In a similar spirit to RTFM.
The aForementioned Article

the F is usually something else though ...

My OS professor in college told us "RTFM means read the manual; the 'f' is silent"
It’s the same F as in BFG. The gun, not the giant.
The Fine Article.
The (forementioned) article, I would imagine.
The Fabulous Article.
TFA is Slashdot jargon for "The F'ing Article".
TFA on Slashdot... Takes me back to the good old days of 2007...
And this only makes sense in a multi-core system (where the spinlock is held on another core). In a single core system if you are trying to take a contended lock in an interrupt you are stuck and can only fail to take it and hope to handle that gracefully.
And even that is only true for systems that don’t use interrupt threads.