lkml.org 
[lkml]   [1998]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: > Re: Linux threads -- as seen in NT Magazine
Date
From

In message <m0zpyLT-0007U1C@the-village.bc.nu>, Alan Cox writes:

> > 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.

This sounds rather arbitrary. Is there a rule to follow here?

How do you spin lock briefly? You mean break it on a timer?
And do you mean to literally call sched_yield several times in a row?

It's too bad I don't have any books covering this kind of thing,
because it would be nice to have when playing with threads. Most
books have a ``trust the kernel functions'' POV.

> 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

You can use IPC like this on systems without locks or rendesvous
functions to get the same effect. Not perfect, but if it's all
you have...

--
Shannon - shendrix@widomaker.com - www.widomaker.com - Linux 2.0.x
----------------------------------------------------------------------
"If history teaches anything, it teaches self-delusion in the face
of unpleasant facts is folly." -- Ronald Reagan


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.079 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site