[Zope] Re: Unfair Linux Threads And Python Oh My

Bill Anderson bill@libc.org
Wed, 26 Apr 2000 16:50:09 -0600


Marcus Collins wrote:
> 
> > -----Original Message-----
> > From: Chris McDonough [mailto:chrism@digicool.com]
> > Sent: 26 April 2000 06:08
> > To: Evan Simpson
> > Cc: Tony Rossignol; Tres Seaver; Marcus Collins; Bill Anderson;
> > zope@zope.org
> > Subject: Re: [Zope] Re: Unfair Linux Threads And Python Oh My
> >
> > Can a few folks with BSD/Solaris/HPUX/whateverotherthanLinux
> > boxes try the script that Tony found and see what it does on
> > their machines?
> 
> $ uname -mrs
> FreeBSD 3.3-STABLE i386
> 
> The test script forks a single child and starts chowing cpu, but produces no
> output on the terminal (it keeps looping in the while 1: pass).
> 
> Some observations:
> 
> If I replace the call to sys.stderr.write with a simple print, then I get a
> single asterisk. Is sys.stderr.write() perhaps buffered?

Call it with "python -u" and it is unbuffered:
"""-u     : unbuffered binary stdout and stderr (also
PYTHONUNBUFFERED=x)"""

Likewise, dropping off the fork() and rearranging the code removed the
problem.


-- 
In flying I have learned that carelessness and overconfidence are 
usually far more dangerous than deliberately accepted risks. 
          -- Wilbur Wright in a letter to his father, September 1900