Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #5447

Re: Mutexes are faster then spinlocks

From Bonita Montero <Bonita.Montero@gmail.com>
Newsgroups comp.programming.threads
Subject Re: Mutexes are faster then spinlocks
Date 2020-01-05 17:43 +0100
Organization albasani.net
Message-ID <qut3n1$9j5$1@news.albasani.net> (permalink)
References <5BnQF.827125$kBJ1.28344@fx12.am4>

Show all headers | View raw


The issue with spinlocks is that spinlocks would theoretically make
sense if there's a high degree of contention and the locks are held
very shortly so that - theoretically - spinning might win. But if
there's a high degree of contention it would be rare that a single
thread might win on spinning. So the likehood of going to sleep in
this case is very high and you can drop spinning.
But spinlocks are of course inevitable in the kernel in cases of
contention between code-parts that run with disabled scheduler,
f.e. when a thread with disabled scheduler contends on a resource
with an interrupt which might also contend on that resource.

Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Mutexes are faster then spinlocks Melzzzzz <Melzzzzz@zzzzz.com> - 2020-01-05 15:50 +0000
  Re: Mutexes are faster then spinlocks Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-05 17:43 +0100
    Re: Mutexes are faster then spinlocks Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-05 17:53 +0100

csiph-web