[Pythonmac-SIG] Trying to track down a bug in BitTorrent for Mac OS 9

Jack Jansen Jack.Jansen at cwi.nl
Thu Apr 15 17:54:52 EDT 2004


Ah! Benjamins suggestion is a good one, threading is lousy on OS9,
and more so in Python.

> I do notice that the problem tends to get even worse when BT is 
> running in
> the background (though 2.3.3 seems to have mitigated that somewhat).
> Actually, BT runs terribly in the background in general -- if I don't 
> keep
> it in the foreground during a transfer, it loses a lot of 
> upload/download
> speed and eventually drops the connection completely.

This is a known bug (or feature:-) in MacPython-OS9: in the background
it becomes very "friendly" and takes only very few cycles. Unfortunately
this can mean it even takes few cycles it the foreground process doesn't
want the cycles anyway. Various other OS9 apps share this problem, try
stuffit expander in the background, for instance:-(

There's a call SchedParams in the MacOS module that you can use to
influence this behaviour.

> But alas, this didn't help either:  quitting the Finder didn't result 
> in
> any appreciable increase in speed.  To me, that strongly suggests that 
> the
> bottleneck _isn't_ any kind of processor overload, since quitting the
> Finder in Mac OS 9 consistently boosts the speed in applications where 
> the
> CPU is getting maxed out (Virtual PC, for instance).

It could well be the other threads in Bittorrent that are the problem.
The low level I/O library used by Python (GUSI) has some quirks
in this area.

If you can control the number of threads Bittorrent uses try fiddling 
with
that, or seeing whether you can make the other threads do something
harmless (such as time.sleep(1)) while the algorithm runs.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list