From owner-freebsd-hackers Wed Apr 3 12:21:44 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from wrath.cs.utah.edu (wrath.cs.utah.edu [155.99.198.100]) by hub.freebsd.org (Postfix) with ESMTP id 725D437B430 for ; Wed, 3 Apr 2002 12:21:24 -0800 (PST) Received: from famine.cs.utah.edu (famine.cs.utah.edu [155.99.198.114]) by wrath.cs.utah.edu (8.11.6/8.11.6) with ESMTP id g33KLNb20443 for ; Wed, 3 Apr 2002 13:21:23 -0700 (MST) Received: by famine.cs.utah.edu (Postfix, from userid 2373) id B90F823A83; Wed, 3 Apr 2002 13:21:22 -0700 (MST) Received: from localhost (localhost [127.0.0.1]) by famine.cs.utah.edu (Postfix) with ESMTP id A02B9279D6 for ; Wed, 3 Apr 2002 13:21:22 -0700 (MST) Date: Wed, 3 Apr 2002 13:21:22 -0700 (MST) From: John Regehr To: freebsd-hackers@FreeBSD.ORG Subject: Linuxthreads on Linux vs FreeBSD performance question Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi all, I'm writing a paper for the FREENIX track at USENIX about a tool for measuring scheduling behavior under different operating systems, and I've run across a performance anomaly that I'd like to explain. It's this: for threads created with Linuxthreads, FreeBSD has considerably slower context switches than Linux. There is a set of histograms here: http://www.cs.utah.edu/~regehr/ctx_hist_1.eps that shows the cost of "involuntary" context switches caused by quantum expirations, and therefore includes the cost of handling a clock interrupt. Various Linux kernels are in the 10us range, while FreeBSD is over 30us. For voluntary context switches (caused by sched_yield()) here are the median costs that I get: Linux 2.17us Linux + preemption patch 2.31us FreeBSD 9.96us All numbers are taken on a PIII 850, with FreeBSD 4.5-RELEASE and Linux 2.4.17. All context switches are between threads in the same address space. Anyway, I was speculating that the higher cost is either due to (1) a failure, in FreeBSD, to avoid page table operations when switching between threads in the same addres space, or (2) some other kind of semantic mismatch between Linuxthreads and rfork. Is one of these guesses right? Any help appreciated. Thanks, John Regehr To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message