Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Apr 2002 13:21:22 -0700 (MST)
From:      John Regehr <regehr@cs.utah.edu>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Linuxthreads on Linux vs FreeBSD performance question
Message-ID:  <Pine.LNX.4.21.0204031311270.15454-100000@famine.cs.utah.edu>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0204031311270.15454-100000>