diff options
author | James A. Morrison <ja2morri@uwaterloo.ca> | 2003-01-19 04:30:46 +0000 |
---|---|---|
committer | James A. Morrison <ja2morri@uwaterloo.ca> | 2003-01-19 04:30:46 +0000 |
commit | 2f0372963c9ae464c169cc07c9bfe0a2f22e8702 (patch) | |
tree | 9030b2e314bdcf781d01c8362f0ee39318af65c1 /Mach/PosixSemaphores.mdwn | |
parent | 80f11e83077bb47c205a4f6837a9b7cb5423f206 (diff) |
none
Diffstat (limited to 'Mach/PosixSemaphores.mdwn')
-rw-r--r-- | Mach/PosixSemaphores.mdwn | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Mach/PosixSemaphores.mdwn b/Mach/PosixSemaphores.mdwn new file mode 100644 index 00000000..c77cb08b --- /dev/null +++ b/Mach/PosixSemaphores.mdwn @@ -0,0 +1,9 @@ +Posix Semaphores are an optional part of pthreads. There is currently an implementation for Neal Walfields libpthread, which is included in the hurd sources tree. This implemention uses a mutex and a condition variable. The implmentation is in the mailing list archives at [ [http://mail.gnu.org/archive/html/bug-hurd/2002-11/msg00316.html](http://mail.gnu.org/archive/html/bug-hurd/2002-11/msg00316.html</a>)](http://mail.gnu.org/archive/html/bug-hurd/2002-11/msg00316.html). + +Neal does not want to use this implementation because it adds the overhead of a condition variable. The condition variable imposes the following penalties: 1 extra spinlock/unlock 1 an extra call to a pthread cleanup function. + +The first penalty has virtually no cost because we know that we will never spin trying to get this spin lock because we already have a mutex lock outside the condition variable serializing accesses to the condition variable. + +The second may be more of a performance penalty, but it saves reimplmenting the code in pt-cond-signal.c pt-cond-wait.c, and pthread-timedwait.c . + +-- [[Main/JamesAMorrison]] - 19 Jan 2003 |