7. Setting HogThreshold

Greetings DOSEMU fans,

Hogthreshold is a value that you may modify in your DOSEMU.CONF file. It is a measure of the "niceness" of Dosemu. That is to say, it attempts to return to Linux while DOS is 'idling' so that DOSEMU does not hog all the CPU cycles while waiting at the DOS prompt.

Determining the optimal Hogthreshold value involves a little bit of magic (but not so much really.) One way is to try different values and look at the 'top' reading in another console. Setting the value too low may mildly slow Dosemu performance. Setting the value too high will keep the idling code from working.

That said, a good basic value to try is "half of your Bogo-Mips value". (The Bogo-Mips value is displayed when the kernel is booting, it's an imaginary value somewhat related to CPU performance.)

Setting the value to 0 will disable idling entirely. The default value is 10.

This files is some kind of FAQ on how to use the 'HogThreshold' value in the dosemu config file.

In case you have more questions feel free to ask me ( <andi@andiunx.m.isar.de>).

Those of you who simply want to have DOSEMU running at highest possible speed simply leave the value to zero, but if you are concerned about DOSEMU eating too much CPU time it's worth playing with the HogThreshold value.

Why do I need to set the HogThreshold value, why can't DOSEMU just stop if it is waiting for a keystroke ?

The reason is the way how DOS and a lot of applications have implemented `waiting for a keystroke'.

It's most often done by something similar to the following code fragment :

    wait_for_key:
    	; do something
    	mov ah,1
    	int 0x16 ; check key status
    	jz	wait_for_key ; jump if no key
    	; found a key
            mov ah,0
            int 0x16 ; get key

This means that the application is busy waiting for the keystroke.

What is a good value for HogThreshold to start with ?

On a 40 MHZ 486 start with a value of 10. Increase this value if you to have your DOS application run faster, decrease it if you think too much CPU time is used.

It does not work on my machine.

You need to have at least dosemu0.53pl40 in order to have the anti-hog code in effect.

Why not simply use a very low value of "HogThreshold" ? Do I really have to try an individual value of HogThreshold ?

This would slow down your DOS application. But why not, DOS is slow anyway :-).

How do I found out about CPU usage of DOSEMU ?

Simply use `top'. It displays cpu and memory usage.

P.S. If you want to change the HogThreshold value during execution, simply call
     mov al,12h
     mov bx,the_new_value
     int e6h
This is what speed.com does. If you are interested, please take a look at speed.c.

Notes: If your application is unkind enough to do waits using an int16h fcn 1h loop without calling the keyboard idle interrupt (int 28h), this code is not going to help much. If someone runs into a program like this, let me ( <scottb@eecs.nwu.edu> ) know and I'll rewrite something into the int16 bios.