From owner-freebsd-current Thu Oct 29 08:33:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA13318 for freebsd-current-outgoing; Thu, 29 Oct 1998 08:33:16 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from server.noc.demon.net (server.noc.demon.net [193.195.224.4]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA13309 for ; Thu, 29 Oct 1998 08:33:11 -0800 (PST) (envelope-from fanf@demon.net) Received: by server.noc.demon.net; id QAA12809; Thu, 29 Oct 1998 16:32:51 GMT Received: from fanf.noc.demon.net(195.11.55.83) by inside.noc.demon.net via smap (3.2) id xma012804; Thu, 29 Oct 98 16:32:45 GMT Received: from fanf by fanf.noc.demon.net with local (Exim 1.73 #2) id 0zYvBv-0001OS-00; Thu, 29 Oct 1998 16:44:55 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: freebsd-current@FreeBSD.ORG From: Tony Finch Subject: Re: Thread Scheduler bug In-Reply-To: <199810290942.EAA21626@highwind.com> X-Mailer: VM 6.34 under Emacs 19.34.1 Message-Id: Date: Thu, 29 Oct 1998 16:44:55 +0000 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG HighWind Software Information wrote: > >I'm worried about the thread scheduler. Here is a disturbing test >program out for folks to try. > >As you can probably guess, we are now battling the scheduler because >some of our application's threads are getting seriously starved by >other threads. We've been having what seem to be related problems. We're currently running Squid on a number of 2.2 boxen, but we're keen to move to 3.0 because of the potential performace improvement that asynchronous IO can provide -- normal Squid tends to get IO bound, and the threaded async-io version could fix that. Unfortunately libc_r doesn't seem up to the task :-( The problematic code is the async-io initialisation: [...] pthread_attr_init(&globattr); pthread_attr_setscope(&globattr, PTHREAD_SCOPE_SYSTEM); globsched.sched_priority = 1; main_thread = pthread_self(); pthread_setschedparam(main_thread, SCHED_OTHER, &globsched); globsched.sched_priority = 2; pthread_attr_setschedparam(&globattr, &globsched); /* Create threads and get them to sit in their wait loop */ [...] This won't compile owing to the lack of some of the scheduling functions, and if you try simply taking them out (as has been suggested in the past on freebsd-questions) then Squid fails to start because it cannot communicate with the dnsserver child processes. This seems to indicate a scheduling problem of some sort. Squid doesn't make any sort of yield calls; would this cause such problems? What is the status of the kernel threads project? It occurs to me that some of the other new functionality of 3.0 is quite similar to that used by the linuxthreads implementation -- rfork() is quite similar to Linux's clone(); does the POSIX.1b stuff help for thread scheduling? Tony. -- fanf@demon.net dot@dotat.at To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message