bz2 & cpu usage

Stefan Behnel behnel_ml at dvs1.informatik.tu-darmstadt.de
Tue Oct 19 10:04:45 EDT 2004


Brad Tilley schrieb:
> I'd like to keep at least 50% of the cpu free while doing bz2 file 
> compression. Currently, bz2 compression takes between 80 & 100 percent 
> of the cpu and the Windows GUI becomes almost useless. How can I lower 
> the strain on the cpu and still do compression? I'm willing for the 
> compression process to take longer.

Three approaches:

1) Use a thread for the I/O part (i.e. the de/compression) and another one 
for the GUI.

2) Collect the files first, then handle one after the other and return to 
the GUI in between.

3) Use a non-blocking scheme for the whole thing (may be the trickiest).

Stefan



More information about the Python-list mailing list