Subject: pthreads -/-> SMP Thread-safe
To: None <>
From: Brian C. Grayson <>
List: tech-userlevel
Date: 09/13/1998 23:19:03
  Before I go into gory details, it appears to me that the
pthreads system allows race conditions when used on an SMP
system.  There are also `volatile's missing.  Are these
well-known deficiencies of the pthreads pkg whose fixes have
been delayed until we get something up-and-running?

  I can give examples of multi-CPU race conditions in
pthread_queue_enq(), for those interested.  I looked at
FreeBSD's code, and they adopted the approach of adding
spinlocks to the top-level code, which I find non-ideal --- if
enqueuing requires an atomic action, then the atomic action
should be done in pthread_enqueue_enq(), and not in every
calling function.  If performance is the reason, then gcc has
supported inlining for years now. :)  But then again, I don't
know much about pthreads, only about hand-rolled SMP

  Happy hacking!

"Anybody want to guess the answer?" -- Ken Richardson, Math 381, discussing
	the equation for diffusion along an infinite line.