KSE system scope vs non system scope threads

Daniel Eischen eischen at vigrid.com
Sat Nov 29 22:06:54 PST 2003


On Sat, 29 Nov 2003, Christopher M. Sedore wrote:

>  I have a fairly simple question about KSE threads: In a threaded program
> using KSE threads, what is the effective difference between a system-scope
> thread and a non-system-scope thread?  If I understand the KSE architecture
> correctly, there should not be a significant functional difference.  If my
> reading lead me to the right conclusion, at the nitty-gritty level, there
> are multiple KSE groups created with system-scope threads, as I understand
> it, meaning that the kernel scheduler actually does the scheduling work for
> system-scope threads, instead of the userland KSE scheduler.

For the most part yes, but even system scope threads are
sometimes dependent on the userland scheduler (when it comes
to mutexes, CVs, signals, etc).

>  I ask this because I'm observing some behavior that I don't expect.  When
> running a threaded program with KSE and non-system-scope threads, I see
> performance degradation in my network traffic when I'm attempting to connect
> to remote hosts that are down.  Libthr doesn't see this degradation, and KSE
> with system-scope threads doesn't perform as well as libthr, but is much
> closer.

Define what you think is degradation.  Process scope threads run in the
same KSEG.  They are all kept in the same priority-based run-queue.
If you have other threads that have equal or higher priority than
the network threads in question, they will/may run before those
threads.  All it takes is one thread that doesn't block (CPU-bound)
to eat away at the time allotment for your other threads.

If a remote host is down and a thread can't connect to it, that thread
should block allowing other threads to run.  Are you using blocking
or non-blocking connects?

>  If there is a canonical document that describes all this, a pointer would
> be very welcome.

It pretty much is what POSIX states it should be, WRT process and
system scope.  Other than that, see:

  http://www.freebsd.org/kse/index.html

and "Further Reading".

-- 
Dan Eischen



More information about the freebsd-threads mailing list