Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Nov 1999 11:19:49 -0600
From:      "Richard Seaman, Jr." <dick@tar.com>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        Peter Wemm <peter@netplex.com.au>, David Greenman <dg@root.com>, Julian Elischer <julian@whistle.com>, current@FreeBSD.ORG
Subject:   Re: Which is the truth? (sycalls and traps)
Message-ID:  <19991128111949.O1408@tar.com>
In-Reply-To: <199911281634.IAA44858@apollo.backplane.com>
References:  <19991128054519.2CB181C6D@overcee.netplex.com.au> <199911281634.IAA44858@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 28, 1999 at 08:34:16AM -0800, Matthew Dillon wrote:

>     Well, it could be 300x but that's like comparing a cache hit to a cache
>     miss - in real terms a UP syscall takes, what, 1-3 uS?  An SMP syscall
>     takes 6 uS.  This on a PIII-450.  Both times can be cut down to less
>     then 500nS with fairly simple optimizations.  Unless you are doing 
>     hundreds of thousands of context switches a second the overhead is in 
>     the noise in real terms, and *definitely* in the noise if you tack on
>     a task switch in the middle of that.

FYI, some measurements I did with the Linuxthreads "port" (ie.
native FreeBSD kernel threads using the linux threads code) on a
266Mhz AMD processor showed the ability to do about 150,000
kernel thread context switches/sec.  The threads didn't do anything
other than context switch, so a "real world" context switch might
be slower, and the rate varies somewhat with the number of threads.
This was uniprocessor, not SMP.

This suggests that kernel thread context switches, to have a measureable
impact on performance at even the 1% level, have to be occurring
at the rate of 1,500/sec or more.  With a faster processor, and
the optimizations you suggest, I'm sure you might well be talking
10,000 switches/sec to matter.

I don't have any threaded apps that come close to this, but perhaps
they exist.  And, unless you can fix the "user thread" scheduler so
it doesn't make any syscalls, its hard to see much of an advantage
for user thread context switches over kernel thread context switches,
from a performance standpoint. (The current user thread scheduler
can actually be slower at context switches that kernel threads,
because of the nubmer of syscalls it makes).

-- 
Richard Seaman, Jr.           email: dick@tar.com
5182 N. Maple Lane            phone: 262-367-5450
Chenequa WI 53058             fax:   262-367-5852


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991128111949.O1408>