From owner-freebsd-current Sun Nov 28 9:28:54 1999 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 2580F14BD7 for ; Sun, 28 Nov 1999 09:28:52 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id JAA45072; Sun, 28 Nov 1999 09:28:48 -0800 (PST) (envelope-from dillon) Date: Sun, 28 Nov 1999 09:28:48 -0800 (PST) From: Matthew Dillon Message-Id: <199911281728.JAA45072@apollo.backplane.com> To: "Richard Seaman, Jr." Cc: Peter Wemm , David Greenman , Julian Elischer , current@FreeBSD.ORG Subject: Re: Which is the truth? (sycalls and traps) References: <19991128054519.2CB181C6D@overcee.netplex.com.au> <199911281634.IAA44858@apollo.backplane.com> <19991128111949.O1408@tar.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :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 Your numbers mesh with mine very well -- 266MHz AMD @ 150Kswitch/sec, 450 MHz PIII at around 500K to 1Mswitch/sec (my test was with a simple entry, context switch, and exit. No floating point in the context switch). If you include FP state I would expect around 500Kswitch/sec on a PIII-450. Another thing to note is that the overhead is of course for a single cpu and does not compound when you have additional cpu's. It seems well worth doing to me. Also consider the fact that in a heavily loaded system, scheduling a thread does not necessarily cause an immediate context switch so we are really talking about context switches here as being the limiting factor, not scheduling and descheduling operations, and not asynchronous message-passing operations. 150Kswitch/sec/cpu goes far beyond what most systems require. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message