From owner-freebsd-performance@FreeBSD.ORG Fri Oct 31 09:04:09 2008 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 805311065670 for ; Fri, 31 Oct 2008 09:04:09 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from mx.bulinfo.net (mx.bulinfo.net [193.194.156.1]) by mx1.freebsd.org (Postfix) with ESMTP id 399118FC1B for ; Fri, 31 Oct 2008 09:04:09 +0000 (UTC) (envelope-from krassi@bulinfo.net) Received: from localhost (localhost [127.0.0.1]) by mx.bulinfo.net (Postfix) with ESMTP id 98B76CAAD; Fri, 31 Oct 2008 11:04:07 +0200 (EET) Received: from mx.bulinfo.net ([127.0.0.1]) by localhost (mx.bulinfo.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 72124-10; Fri, 31 Oct 2008 11:04:06 +0200 (EET) Received: from [192.168.2.188] (pythia.bulinfo.net [212.72.195.5]) by mx.bulinfo.net (Postfix) with ESMTP id C4FF1CA4C; Fri, 31 Oct 2008 11:04:06 +0200 (EET) Message-ID: <490ACA04.6060203@bulinfo.net> Date: Fri, 31 Oct 2008 11:04:04 +0200 From: Krassimir Slavchev User-Agent: Thunderbird 2.0.0.14 (X11/20080616) MIME-Version: 1.0 To: Julian Elischer References: <000001c93b0c$6195e6b0$2f096f0a@china.huawei.com> <490AB477.2080001@bulinfo.net> <490AB750.9040505@elischer.org> In-Reply-To: <490AB750.9040505@elischer.org> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at mx.bulinfo.net Cc: freebsd-performance@freebsd.org, Sam Xia Subject: Re: 1. thread switching time? (Krassimir Slavchev) X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2008 09:04:09 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello Julian, Julian Elischer wrote: > Krassimir Slavchev wrote: > >> >> Also, I am able to set HZ=100000 but the thread switching time is still >> ~1ms. > > You must be talking about the time that a thread can run before it is > pushed out by other threads? I know I've seem many x 10,000 context > switches in some cases, i.e. look at very high interrupt rates > etc. so I guess I'm not sure what you are measuring.. Okay, I have a thread with: while(1) { clock_gettime(CLOCK_REALTIME, &tv); nanosleep(&delay, NULL); clock_gettime(CLOCK_REALTIME, &tv2); timespecsub(&tv2, &tv); } If the delay is configured to be 0 < delay < 1ms I always get ~1ms delay. Since nanosleep() is a cancellation point this means that the scheduler will switch to another thread. If the delay = 0 I get ~1600ns delay. Yes. You are right. This is "the time that a thread can run before it is pushed out by other threads". Is there a way to decrease this time? > > at one time the scheduling quantum was independent of Hz. > I am not sure how true that is now.. > It seems to be independent of HZ. Best Regards > > _______________________________________________ > freebsd-performance@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-performance > To unsubscribe, send any mail to > "freebsd-performance-unsubscribe@freebsd.org" > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFJCsoDxJBWvpalMpkRAteuAJ9Jd8ICvPSiWB/4eGquUunoclpeXgCgjqyE vBXA0vGoRgsQ9eHZ/YwR/lw= =AjjC -----END PGP SIGNATURE-----