yielding control

Rob Hall bloke at ii.net
Tue Oct 15 14:04:57 EDT 2002


I actually anticipated this answer.

> Get a better operating system. The OS should share things
> out so that at least you can control the mouse. On linux
> you can say this process doesn't get more than X% of the CPU,
> or trivially change the priorities of the python process
> so that it's queued behind everything else.
>

The program processes a series of sets.  Under W98 I get an average process
rate of around 24000 sets per second with a max rate of over 28000 sets/sec.

I ran it under Mandrake 8.2 with the GUI and all daemons switched off and
got an average rate of less than 19000/sec.  Hence I run it under W98.

I can change the priority under W98 and thus gain gontrol of the OS.  But I
have to do that from outside my Python script.  I'd rather yield control to
the OS periodically from the script for simplicity's sake.

The other thing is that my 'mouse' is actually a graphics tablet, which
itself is CPU intensive.  A 'normal' mouse works pretty much fine.

> If you are guaranteed that you can break your work into
> scheduler sized units (10ms on windos 98) you could
> do this yourself I suppose with sleep functions in the
> loop, but seriously this is the operating systems job.
>

A call to sleep would slow down the script even when I am not using the
computer for something else.  It was my first thought too.  I'm sure I read
somewhere once that it can be done, but for the life of me can't remember
where.

Rob






More information about the Python-list mailing list