Re: Kernel synchronisation support - comments ?

Theodore Y. Ts'o (tytso@MIT.EDU)
Tue, 28 Jan 1997 17:49:42 -0500


From: Richard Watts <Richard.Watts@cl.cam.ac.uk>
Date: Tue, 28 Jan 1997 17:24:52 +0000

This is a request for comments on the use of kernel synchronisation
support. As part of an attempt to implement native threads for Linux
in SRC Modula-3, I ran into a couple of problems with the user-level
support provided by things like pthreads :

(i) There seems to be no (adequate) suspend() mechanism.
(ii) They use up signals, and play around with signal masks, which
may not be what you want.

What's wrong with sem_wait() and sem_trywait(), which are the standard
System V mechanisms for handling synchronization?

Also, if you want really fast sychronization across native threads (and
security isn't an issue because all of the accesses are via cooperating
threads which are at the same security level), you'll want to do this
via shared memory and some atomic test-and-set instructions. For some
applications the kernel context switch time will be unacceptable.

See Gallmeister's "Programming for the Real World" book, which documents
the POSIX.4 (aka POSIX.1b) international standard for doing POSIX
real-time programming (including semaphores) for more information.

- Ted