Re: > Re: Linux threads -- as seen in NT Magazine

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 15 Dec 1998 17:33:14 +0000 (GMT)


> I'm not sure I can claim to completely understand the following code,
> but I believe that on SMP the behaviour is not as you describe above.

You are looking at the kernels own locking subsystem not the locks done
by the glibc thread library

> If the thread actually sleep(2)'s on some event, fine. But most
> user-level threads use user-level events (i.e. pthread_cond_wait()),
> this ultimately resolves to a sched_yield() call, not a call to
> sleep().

That would just be crap userspace code. A good userspace lock does direct
CPU dependant spin locking briefly, then sched_yield a few times then
either backs off or drops to a semaphore lock.

> Are you running on an SMP machine ? Do you have a threaded, order
> dependent pipeline that uses user-level threads and no kernel-level
> synchronization ?

I the pipeline length is strictly bounded, and the objects in it are
type constant do you need any locking anyway. It ought to be almost lockless

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/