Coda File System

Re: LWP on top of pthreads

From: Jan Harkes <>
Date: Thu, 18 Sep 2003 12:06:19 -0400
On Thu, Sep 18, 2003 at 05:05:42PM +0300, Jarkko Tolvanen wrote:
> How stable/usable is LWP implementation on top of pthreads?

Whatever is in CVS is actually stable enough to run both venus and
codasrv successfully. It really was the only way that I could use
valgrind to find some memory problems. Valgrind doesn't like LWP's
under the cover stack switching tricks.

There are three reasons why we're not really using the pthread

- I've discovered that some versions of the LinuxThreads pthread
  implementation have serious flaws.

  f.i. I have reason to believe that on a RedHat-5.1 machine, a critical
  region protected by a mutex was entered by at least 2 threads at the
  same time. Now RedHat-5 is clearly a very old release, but these kinds
  of race conditions are very subtle and hard to diagnose. There are
  enough problems that still need to be found and resolved in Coda

- The pthread version has a significantly higher context switch overhead
  making it somewhat slower, and only the RVM truncate thread is really
  taking advantage of being able to run concurrently.

- At the time I started it, there was no pthread implementation for
  Windows (cygwin), which meant that we still had to maintain/use the
  old LWP implementation either way.

> I found a test program in lwp-1.10/src (testlwp.c), but that didn't work
> when I tried to run it on my Linux PC with the pthreaded LWP library
> compiled from lwp-1.10/src-pt (the main thread is blocked on a condition
> variable and the child thread fails to release it but instead runs a
> simple loop forever). The lwp-pt directory didn't seem to have any test
> programs. Is there any other working test programs?

I used the test programs from the lwp/src directory myself (and ofcourse

> (I updated LWP 1.10 with some pthreaded LWP changes I could found from the
> CVS repository with viewcvs)

Yeah, some of those changes in CVS are definitely required to run with

Received on 2003-09-18 12:08:07