From owner-freebsd-threads@FreeBSD.ORG Mon Dec 27 11:02:21 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DEB9B16A4FB for ; Mon, 27 Dec 2004 11:02:20 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id ABBB443D39 for ; Mon, 27 Dec 2004 11:02:20 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iBRB2KWN030315 for ; Mon, 27 Dec 2004 11:02:20 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iBRB2JV9030309 for freebsd-threads@freebsd.org; Mon, 27 Dec 2004 11:02:19 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 27 Dec 2004 11:02:19 GMT Message-Id: <200412271102.iBRB2JV9030309@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Subject: Current problem reports assigned to you X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Dec 2004 11:02:21 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2004/04/22] threads/65883threads libkse's sigwait does not work after fork 1 problem total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/07/18] kern/20016 threads pthreads: Cannot set scheduling timer/Can o [2000/08/26] kern/20861 threads libc_r does not honor socket timeouts o [2001/01/20] threads/24472threads libc_r does not honor SO_SNDTIMEO/SO_RCVT o [2001/01/25] threads/24632threads libc_r delicate deviation from libc in ha o [2001/01/25] kern/24641 threads pthread_rwlock_rdlock can deadlock o [2001/11/26] bin/32295 threads pthread dont dequeue signals o [2002/02/01] threads/34536threads accept() blocks other threads o [2002/05/25] kern/38549 threads the procces compiled whith pthread stoppe o [2002/06/27] threads/39922threads [PATCH?] Threaded applications executed w o [2002/08/04] kern/41331 threads Pthread library open sets O_NONBLOCK flag o [2003/03/02] threads/48856threads Setting SIGCHLD to SIG_IGN still leaves z o [2003/03/10] threads/49087threads Signals lost in programs linked with libc o [2003/05/08] threads/51949threads thread in accept cannot be cancelled s [2004/03/15] kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/un o [2004/08/26] threads/70975threads unexpected and unreliable behaviour when o [2004/09/14] threads/71725threads Mysql Crashes frequently giving Sock Erro o [2004/10/05] threads/72353threads Assertion fails in /usr/src/lib/libpthrea o [2004/10/07] threads/72429threads threads blocked in stdio (fgets, etc) are o [2004/10/21] threads/72953threads fork() unblocks blocked signals w/o PTHRE o [2004/11/25] threads/74370threads Cannot get lwp 0 registers in gdb o [2004/12/08] threads/74856threads dig/host broken w/ libthr o [2004/12/19] threads/75273threads FBSD 5.3 libpthread (KSE) bug o [2004/12/21] threads/75374threads pthread_kill() ignores SA_SIGINFO flag 23 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/05/26] kern/18824 threads gethostbyname is not thread safe o [2000/06/13] kern/19247 threads uthread_sigaction.c does not do anything o [2000/10/21] kern/22190 threads A threaded read(2) from a socketpair(2) f o [2001/09/09] threads/30464threads pthread mutex attributes -- pshared o [2002/05/02] threads/37676threads libc_r: msgsnd(), msgrcv(), pread(), pwri s [2002/07/16] threads/40671threads pthread_cancel doesn't remove thread from o [2004/07/13] threads/69020threads pthreads library leaks _gc_mutex o [2004/09/21] threads/71966threads Mlnet Core Dumped : Fatal error '_pq_inse o [2004/11/21] threads/74180threads KSE problem. Applications those riched ma 9 problems total. From owner-freebsd-threads@FreeBSD.ORG Thu Dec 30 02:47:07 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 136D316A4CE for ; Thu, 30 Dec 2004 02:47:07 +0000 (GMT) Received: from web52401.mail.yahoo.com (web52401.mail.yahoo.com [206.190.39.109]) by mx1.FreeBSD.org (Postfix) with SMTP id A038043D46 for ; Thu, 30 Dec 2004 02:47:06 +0000 (GMT) (envelope-from dcieslicki@yahoo.com) Received: (qmail 94881 invoked by uid 60001); 30 Dec 2004 02:47:06 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=AR3pI4A6YF4a7HvKr3ReEYvndBrv4NafDeb94yLruRq/K/Qu4R+IavIdNlJEiEB7lCwmnOvuguqzqS0bydgfi6YTjhNKceCxIKF6ADbulhYeHKNcAQdesmT/XNUVa1Xf4nnS5wDaVEXrgOkcOBDxJfGqvVRCeLdM51T440wYz9M= ; Message-ID: <20041230024706.94879.qmail@web52401.mail.yahoo.com> Received: from [129.210.209.28] by web52401.mail.yahoo.com via HTTP; Wed, 29 Dec 2004 18:47:06 PST Date: Wed, 29 Dec 2004 18:47:06 -0800 (PST) From: Damian Cieslicki To: freebsd-threads@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Thread time spikes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2004 02:47:07 -0000 Hi folks, I just wonder about the time behavior of this simple threaded program: #include /* threading */ #include /* printf */ #include /* exit */ #define MILLION 1000000L #define THOUSAND 1000L /* prototypes */ void * doit(void *arg); /* ************************************************************************* */ int main (int argc, char **argv){ long duration1; pthread_t pthread_id; struct timespec tv1start, tv1end; clock_gettime(CLOCK_REALTIME, &tv1start); // real /* thread ... */ pthread_create(&pthread_id, NULL, doit, NULL); pthread_join(pthread_id, NULL); /* vs function call */ // doit(NULL); clock_gettime(CLOCK_REALTIME, &tv1end); duration1 = MILLION*(tv1end.tv_sec - tv1start.tv_sec) + (tv1end.tv_nsec - tv1start.tv_nsec)/THOUSAND; printf("%ld\n", duration1); exit(0); } /* ************************************************************************* */ void* doit(void *arg){ int k; k=42; /* heavy computation */ return(NULL); } /* ************************************************************************* */ compiler options: gcc -D_THREAD_SAFE -g -Wall -pthread threadspikes.c -o threadspikes os: freebsd 5.2, generic kernel hw: Pentium III 500 Mhz. load: no real computation, just the standard daemons and x window are running. Why does the threaded program take each 10th time much longer?: Why I get these "time spikes" ? 359 392 365 379 374 2474 370 363 365 376 364 364 397 378 393 389 370 365 3221 366 377 replacing the thread with a function call reduces the number of spikes drastically but they still do occur (even more drastically): : 3 3 3 3 3 3 3 19021 I assume there is a global re-scheduling after pthread_create and sometimes a totally different process (like sendmail) gets chosen. But even nice -n -n19 doesn't help. Is there a way to get deterministic results? -- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From owner-freebsd-threads@FreeBSD.ORG Thu Dec 30 07:47:53 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 22D6A16A4CE for ; Thu, 30 Dec 2004 07:47:53 +0000 (GMT) Received: from silver.he.iki.fi (helenius.fi [193.64.42.241]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD3BD43D2D for ; Thu, 30 Dec 2004 07:47:51 +0000 (GMT) (envelope-from pete@he.iki.fi) Received: from [193.64.42.134] (h86.vuokselantie10.fi [193.64.42.134]) by silver.he.iki.fi (8.13.1/8.11.4) with ESMTP id iBU7lms8041110; Thu, 30 Dec 2004 09:47:49 +0200 (EET) (envelope-from pete@he.iki.fi) Message-ID: <41D3B2A6.4090307@he.iki.fi> Date: Thu, 30 Dec 2004 09:47:50 +0200 From: Petri Helenius User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Damian Cieslicki References: <20041230024706.94879.qmail@web52401.mail.yahoo.com> In-Reply-To: <20041230024706.94879.qmail@web52401.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-threads@freebsd.org Subject: Re: Thread time spikes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2004 07:47:53 -0000 Damian Cieslicki wrote: >Hi folks, > >I just wonder about the time behavior of this simple >threaded program: > > How many CPUs on the box? Pete > >#include /* threading */ >#include /* printf */ >#include /* exit */ > >#define MILLION 1000000L >#define THOUSAND 1000L > > >/* prototypes */ >void * doit(void *arg); > > >/* >************************************************************************* >*/ > >int main (int argc, char **argv){ > > long duration1; > pthread_t pthread_id; > struct timespec tv1start, tv1end; > > > clock_gettime(CLOCK_REALTIME, &tv1start); // real > > /* thread ... */ > pthread_create(&pthread_id, NULL, doit, NULL); > pthread_join(pthread_id, NULL); > > /* vs function call */ > // doit(NULL); > > clock_gettime(CLOCK_REALTIME, &tv1end); > > duration1 = MILLION*(tv1end.tv_sec - >tv1start.tv_sec) + > (tv1end.tv_nsec - tv1start.tv_nsec)/THOUSAND; > > > printf("%ld\n", duration1); > > > exit(0); >} > > >/* >************************************************************************* >*/ > > >void* doit(void *arg){ > > int k; > > k=42; /* heavy computation */ > > return(NULL); > >} > >/* >************************************************************************* >*/ > > >compiler options: gcc -D_THREAD_SAFE -g -Wall >-pthread threadspikes.c >-o threadspikes > >os: freebsd 5.2, generic kernel > >hw: Pentium III 500 Mhz. > >load: no real computation, just the standard daemons >and x window are >running. > > > >Why does the threaded program take each 10th time much >longer?: Why I get these "time spikes" ? > >359 >392 >365 >379 >374 >2474 >370 >363 >365 >376 >364 >364 >397 >378 >393 >389 >370 >365 >3221 >366 >377 > > > >replacing the thread with a function call reduces the >number of spikes >drastically but they still do occur (even more >drastically): > >: >3 >3 >3 >3 >3 >3 >3 >19021 > > >I assume there is a global re-scheduling after >pthread_create and sometimes a totally different >process (like sendmail) gets chosen. But even >nice -n -n19 doesn't help. > >Is there a way to get deterministic results? > > > > > From owner-freebsd-threads@FreeBSD.ORG Thu Dec 30 19:24:11 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6064716A4CE for ; Thu, 30 Dec 2004 19:24:11 +0000 (GMT) Received: from mail2.mail.iol.ie (mail2.mail.iol.ie [193.95.141.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2478E43D1F for ; Thu, 30 Dec 2004 19:24:11 +0000 (GMT) (envelope-from s_sourceforge@nedprod.com) Received: from dialup124.ts521.cwt.esat.net ([194.165.162.124] helo=laptop) by mail2.mail.iol.ie with esmtp (Exim 3.36 #9) id 1Ck5u5-000051-00 for freebsd-threads@freebsd.org; Thu, 30 Dec 2004 19:24:10 +0000 From: "Niall Douglas" To: freebsd-threads@freebsd.org Date: Thu, 30 Dec 2004 19:28:01 -0000 MIME-Version: 1.0 Message-ID: <41D456C1.2022.69D50F@localhost> Priority: normal In-reply-to: <41D3B2A6.4090307@he.iki.fi> References: <20041230024706.94879.qmail@web52401.mail.yahoo.com> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Subject: Re: Thread time spikes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2004 19:24:11 -0000 On 30 Dec 2004 at 9:47, Petri Helenius wrote: > Damian Cieslicki wrote: > > >Hi folks, > > > >I just wonder about the time behavior of this simple > >threaded program: > > > > > How many CPUs on the box? I've seen behaviour very similar to this on FreeBSD 5.3 BSD scheduler uniprocessor athlon. I had assumed that it's something which will get fixed as threading support matures. Cheers, Niall From owner-freebsd-threads@FreeBSD.ORG Thu Dec 30 23:16:46 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FC0116A4CF for ; Thu, 30 Dec 2004 23:16:46 +0000 (GMT) Received: from mail.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B05143D2D for ; Thu, 30 Dec 2004 23:16:46 +0000 (GMT) (envelope-from julian@elischer.org) Received: from elischer.org (julian.vicor-nb.com [208.206.78.97]) by mail.vicor-nb.com (Postfix) with ESMTP id 5B26E7A403; Thu, 30 Dec 2004 15:16:46 -0800 (PST) Message-ID: <41D48C5D.5000906@elischer.org> Date: Thu, 30 Dec 2004 15:16:45 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030516 X-Accept-Language: en, hu MIME-Version: 1.0 To: Damian Cieslicki References: <20041230024706.94879.qmail@web52401.mail.yahoo.com> In-Reply-To: <20041230024706.94879.qmail@web52401.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-threads@freebsd.org Subject: Re: Thread time spikes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Dec 2004 23:16:46 -0000 Damian Cieslicki wrote: >os: freebsd 5.2, generic kernel > Nothing is guaranteed on 5.2 it was a prerelease. try 5.3 or -current. there may still be problems but at least we'll know what we are talking about. > >hw: Pentium III 500 Mhz. > >load: no real computation, just the standard daemons >and x window are >running. > > try rtprio as well > > >