aboutsummaryrefslogtreecommitdiffstats
path: root/man3/pthread_spin_init.3
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2017-10-02 22:36:50 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2017-10-20 10:20:48 +0200
commit2dea72418db7f44f71018b9228bbcf8d80c38ad4 (patch)
tree2fc8bba605771d62508856015de411f8a52b1f8d /man3/pthread_spin_init.3
parent41041696d3bb135aa72aee029e3f5ad35539ec1a (diff)
downloadman-pages-2dea72418db7f44f71018b9228bbcf8d80c38ad4.tar.gz
pthread_spin_init.3: Spin locks should be used with real-time scheduling policies
Reported-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man3/pthread_spin_init.3')
-rw-r--r--man3/pthread_spin_init.313
1 files changed, 13 insertions, 0 deletions
diff --git a/man3/pthread_spin_init.3 b/man3/pthread_spin_init.3
index af9a926718..9d43fd035e 100644
--- a/man3/pthread_spin_init.3
+++ b/man3/pthread_spin_init.3
@@ -114,6 +114,19 @@ POSIX.1-2001.
.PP
Support for process-shared spin locks is a POSIX option.
The option is supported in the glibc implementation.
+.SH NOTES
+Spin locks should be employed in conjunction with
+real-time scheduling policies
+.RB ( SCHED_FIFO ,
+or possibly
+.BR SCHED_RR ).
+Use of spin locks with nondeterministic scheduling policies such as
+.BR SCHED_OTHER
+probably indicates a design mistake.
+The problem is that if a thread operating under such a policy
+is scheduled off the CPU while it holds a spin lock,
+then other threads will waste time spinning on the lock
+until the lock holder is once more rescheduled and releases the lock.
.SH SEE ALSO
.ad l
.nh