From owner-freebsd-current Sun Nov 28 9:20:29 1999 Delivered-To: freebsd-current@freebsd.org Received: from test.tar.com (test.tar.com [204.95.187.4]) by hub.freebsd.org (Postfix) with ESMTP id EE01914A09 for ; Sun, 28 Nov 1999 09:20:20 -0800 (PST) (envelope-from dick@test.tar.com) Received: (from dick@localhost) by test.tar.com (8.9.3/8.9.3) id LAA28598; Sun, 28 Nov 1999 11:19:49 -0600 (CST) (envelope-from dick) Date: Sun, 28 Nov 1999 11:19:49 -0600 From: "Richard Seaman, Jr." To: Matthew Dillon Cc: Peter Wemm , David Greenman , Julian Elischer , current@FreeBSD.ORG Subject: Re: Which is the truth? (sycalls and traps) Message-ID: <19991128111949.O1408@tar.com> References: <19991128054519.2CB181C6D@overcee.netplex.com.au> <199911281634.IAA44858@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: <199911281634.IAA44858@apollo.backplane.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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