Re: Keyboard idle check eating resources

Bart Oldeman
2002-11-06T01:25:06Z

On Wed, 6 Nov 2002, Cezar Cichocki wrote:

> We are using few DOSEMu on one of the servers. They are working greate
> however they are consuming a lot of resources while sitting in the
> "keyboard idle loop" (this is old code, wroten in Borland Pascal).
>
> What can we do to improve performace?

Two ways.
a) change your Pascal program to not use a construct such as
while not keypressed do;
if you cannot use a straight "readkey" (i.e. the program must do
something in the loop) you can still release time slices by calling
int2f/ax=$1680 for each loop iteration (IIRC in BP you can do that
using "intr")

b) or get the development version 1.1.3 and patch up to 1.1.3.7
(www.dosemu.org/testing) which automatically sleeps a little if the
BIOS is asked whether a key is available and there is no key available.

and make sure that $_hogthreshold is NOT set to 0, but set to 1 (or some
higher value if 1 is too slow).

Bart