From owner-freebsd-java Tue Jan 12 18:21:15 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA10548 for freebsd-java-outgoing; Tue, 12 Jan 1999 18:21:15 -0800 (PST) (envelope-from owner-freebsd-java@FreeBSD.ORG) Received: from fever.semiotek.com (host-062.canadiantire.ca [209.146.201.62]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA10541 for ; Tue, 12 Jan 1999 18:21:13 -0800 (PST) (envelope-from reader@fever.semiotek.com) Received: (from reader@localhost) by fever.semiotek.com (8.8.8/8.8.7) id VAA02530 for freebsd-java@freebsd.org; Tue, 12 Jan 1999 21:20:38 -0500 (EST) (envelope-from reader) Message-ID: <19990112212038.E2400@semiotek.com> Date: Tue, 12 Jan 1999 21:20:38 -0500 From: Justin Wells To: freebsd-java@FreeBSD.ORG Subject: busywait in IOstream code? Mail-Followup-To: freebsd-java@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.1i Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org I have a multithreaded program which normally runs under a web server, but I have a bunch of command line test harnesses that I run against it, basically I type in a command and it does something--I use this to debug my program. However, I noticed when doing this that my background threads weren't ever getting a chance to execute. Doing this in a high priority thread: for(;;;) { sleep(someTime); } solved the problem (causes a thread scheduling event every someTime msecs). I conclude from this that there is some code in IOStream that is busywaiting and not yielding. It may only happen when IO is being read from the console, since have not noticed the bug when IO comes from somewhere else (usu. servletrunner, Apache-jserv, etc.). Busy-waiting in general is bad; busy-waiting without even a yield is a nasty bug. (Even with a yield it is dubious.) Justin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message