Coda File System

Re: LWPs in Coda and native platform threads

From: Shafeeq Sinnamohideen <shafeeq_at_cyrus.watson.org>
Date: Mon, 27 Jul 1998 16:25:37 -0400 (EDT)
On Mon, 27 Jul 1998, Jim Doyle wrote:
> I guess I dont understand how LWPs are exploited by Coda... It seems
> to me that your concern is that the non-preemptive nature of these
> user-space threads and exploitation of that feature in the design of
> Coda makes it hard to conceive a port to another Threads API. Maybe
> I dont understand the subtlety of this because I havent looked at
> the code long enough.. It would seem to me that you could retain the
> same control of the threads scheduler by simply using condition
> variables to force a scheduler context change from one thread to 
> another thread... Condition variables are how you do interthread
> communications - this is how you build programs where one thread
> does some work and then passes control to another thread to do
> some other work that you've prepared for it.
> 
> Could you explain what it is that isnt in Pthreads that makes
> this conjecture difficult ?

The main problem is that Pthreads are preemptive, but a lot of the client
& server code lacks protections for critical sections. This is safe in LWP
because no thread will start running until you explicitly yield but will
lead to chaos with preemptive threads. 
Removing all trace of LWP from Coda would involve finding all the critical
sections and protecting them with mutexes, which would be very
time-consuming, but necessary to fully use SMP. Using condition variables
to simulate LWP thread scheduling is possible, and is exactly what LWP on
Cthreads does, but this suffers from having only 1 active LWP at a time.

Shafeeq
Received on 1998-07-27 16:31:15