4 ms·
>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 wit
by simias 7y 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.
- vba 7y agoTFA? Tried to google but unsuccessful
- wgjordan 7y agoThe (forementioned) article, I would imagine.
- hyperion2010 7y agoThe aForementioned Article the F is usually something else though ...
- axaxs 7y agoThe (Fuc|Frea)king Article. In a similar spirit to RTFM.
- ddebernardy 7y agoTFA is Slashdot jargon for "The F'ing Article".
- mgalgs 7y agoTFA on Slashdot... Takes me back to the good old days of 2007...
- NeedMoreTea 7y agoI'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.
- simias 7y agoI 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.
- gpderetta 7y agoThe original, as documented in the hacker dictionary, is of course RTFM (read the f...ine manual).
- codezero 7y agoNot sure it’s the origin, but it used to be RTFM (read the fucking manual).
- sjwright 7y agoRTFM has been mostly superseded by LMGTFY.
- tingletech 7y agoAlso read "read the fine manual"
- loeg 7y agoThe Fine Article.
- thatsenough 7y agoThe Fabulous Article.
- trasz 7y agoAnd even that is only true for systems that don’t use interrupt threads.
- lmilcin 7y agoI 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.
- rcxdude 7y agoAnd 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.