Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jan 1999 21:20:38 -0500
From:      Justin Wells <reader@semiotek.com>
To:        freebsd-java@FreeBSD.ORG
Subject:   busywait in IOstream code?
Message-ID:  <19990112212038.E2400@semiotek.com>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990112212038.E2400>