Menu

#531 hogthreshold too coarse adjustment

fixed_in_git
open
nobody
None
5
2014-08-18
2014-05-11
franta
No

playing with actual dosemu-devel, it seems as Hogthreshold setting is too coarse. That are approximate (measured vith 'top' utility) CPU load values ​​depending on the hogthreshold value:

HGT  CPU%   dosemu threads load %
0    147    98 +  48 + 0.3
1    2.7   1.7 + 0.7 + 0.3
2     43    28 +  14 + 0.3
3     80    54 +  24 + 0.3
5    115    75 +  35 + 0.3
10   125    80 +  40 + 0.3

(regards third column: it seems dosemu has active three thread, these three numbers are percentage of load of each)

Thus it seems as only applicable hogthreshold value is 1, all others are causing too high CPU load. Somewhere in doc recommended hogtreshold as half of CPU bogomips (me has ~ 5400) is unrealistic.
This was observerd on C2Duo E8200@2.66GHz/4GB RAM machine, Fedora 19 i686, dosemu in real CPU vm86 mode, in X window; FreeDOS without any DOS apps, it only show 'C:>' prompt.

Discussion

  • Stas Sergeev

    Stas Sergeev - 2014-05-25

    playing with actual dosemu-devel, it seems as Hogthreshold setting is too coarse.

    If you update from git and produce the
    -D6+g log, you'll see the messages there,
    "sleep requested by <name>"
    By the <name> you can find in sources of
    the call to idle() function of dosemu. By
    lowering the second argument of the call,
    you can make it smoother wrt hogthreshold
    setting.</name></name>

     
  • Stas Sergeev

    Stas Sergeev - 2014-05-25

    Darn, SF eats symbols.
    The message would read as
    "sleep requested by <name;&gt"
    and by that name you can find the
    caller in a source.

     
  • franta

    franta - 2014-05-29

    I tried git 687.g2f988a6 version. Regarding to CPU load with this version, now I got these hogthreshold/CPU load results:

     HGT  CPU%   dosemu threads load %
      0   100      99.3 + 0.7 + 0  
      1     1.7     1.0 + 0.7 + 0
      2    16.2    15.5 + 0.7 + 0
      3    31.0    30.1 + 0.7 + 0
      5    60.0    59.5 + 0.7 + 0
      7    77.0    76.3 + 0.7 + 0
      8    70.0    69.3 + 0.7 + 0
     10    61.0    60.3 + 0.7 + 0
     20    78.0    77.4 + 0.7 + 0
     40    93.0    92.0 + 0.7 + 0
    100    94.6    93.9 + 0.7 + 0
    

    which is now better - it seems because second thread now almost does not burden the CPU, and first thred burden it less.

    With your recommended debug settings, 'grep "sleep" debug.log' give (with '$_hogthreshold = (7)' =~ 77% CPU load):

    • 0 matches when autoexec.bat directly ends dosemu (2.6 sec total run)
    • 673 matches when dosemu run a total of 15 seconds.
    • 1435 matches when dosemu run a total of 30 seconds.
    • 3127 matches when dosemu run a total of 61 seconds.

    In all cases logs contains only 'sleep requested by int28' record.
    And now I do not understand what I should do, what I should search in dosemu sources or what 'lowering the second argument of the call' mean.
    Thanks.

     
  • Stas Sergeev

    Stas Sergeev - 2014-05-29

    In int.c find string idle(0, 50, 0, "int28");
    Second argument is 50.
    Try fewer.

     
  • franta

    franta - 2014-05-30

    I did several tests for different second parameter values (original 50, 10, 2, and 1) and for different hogthreshold values (0,1,2,5,10,100). Tests were made tvice, once for default basic debug ('$_debug = "-a+cw"', this produces ~3.5 kB debug.log), the second time for (recommended by you) extended debug ('$_debug = "-a+6cwg"', this produce ~550 MB debug.log - here I can see 'sleep requested by ...' - in tests results is number of their occurrences). All tests only start FreeDOS and took cca 30 seconds (autoexec.bat at its end contain 'choice /t:y,29 подожди 29 сек' and 'exitemu') and was startes with command '/usr/bin/time -o dosemu-load.lst dosemu.bin -X -p'.

    Please see at this results, You will interpret they better than I. What seems interesting for me:

    • when hogthreshold=0, in debug.log are no 'sleep requested by ...' records

    • when hogthreshold=1, in debug.log are 'sleep requested by int2f_idle_magic' records and no 'sleep requested by int28' records

    • for other hogthreshold values, there are only 'sleep requested by int28' records; as hoghthreshold increases, their number decreases.

    • even 'idle(0, 1, 0, "int28")' (second parameter is 1 instead original value 50) in 'src/base/async/int.c' work well with low cpu load (change it?)

    • in dosemu docs somehere recommended hogthreshold setting as half of machine bogomips value seems as unrealistic, this value should be much smaller.

    Tests results:

    idle(0, 50, 0, "int28") and '$_debug = "-a+cw"' :
      1   1.00user  0.65system 0:30.01elapsed  5%CPU
      2   3.50user  3.56system 0:34.67elapsed 20%CPU
      5  10.52user 11.32system 0:30.24elapsed 72%CP
     10  11.39user 12.11system 0:30.11elapsed 78%CPU
     30  13.04user 14.48system 0:30.15elapsed 91%CPU
    100  13.56user 15.28system 0:30.89elapsed 93%CPU
      0  13.82user 15.01system 0:30.11elapsed 95%CPU
    
    idle(0, 50, 0, "int28") and '$_debug = "-a+6cwg"' :
      1   1.29user  0.76system 0:30.33elapsed  6%CPU 3134 sleep requested by int2f_idle_magic
      2   7.84user  3.98system 0:30.25elapsed 39%CPU 3129 sleep requested by int28
      5  13.21user  6.65system 0:30.39elapsed 65%CPU 1542 sleep requested by int28
     10  17.65user  8.74system 0:30.24elapsed 87%CPU 1019 sleep requested by int28
     30  17.85user  9.35system 0:30.43elapsed 89%CPU 338 sleep requested by int28
    100  23.32user 11.12system 0:36.63elapsed 94%CPU 110 sleep requested by int28
      0  19.83user 10.15system 0:30.36elapsed 98%CPU _NO_ 'sleep requested by ...'
    
    idle(0, 10, 0, "int28") and '$_debug = "-a+cw"' :
      1   0.93user  0.59system 0:30.07elapsed  5%CPU
      2   1.37user  1.10system 0:30.46elapsed  8%CPU
      5   2.98user  2.86system 0:30.13elapsed 19%CPU
     10   5.40user  5.67system 0:30.20elapsed 36%CPU
     30   9.16user  9.57system 0:30.52elapsed 61%CPU
    100  11.36user 12.15system 0:30.27elapsed 77%CPU
      0  14.19user 15.39system 0:30.06elapsed 98%CPU
    
    idle(0, 10, 0, "int28") and '$_debug = "-a+6cwg"' :
      1   1.27user  0.63system 0:30.30elapsed  6%CPU 3135 sleep requested by int2f_idle_magic
      2   2.40user  1.26system 0:30.70elapsed 11%CPU 3135 sleep requested by int28
      5   6.11user  3.20system 0:30.97elapsed 30%CPU 3124 sleep requested by int28
     10  11.97user  6.16system 0:30.60elapsed 59%CPU 3044 sleep requested by int28
     30  15.27user  7.57system 0:30.79elapsed 74%CPU 1357 sleep requested by int28
    100  16.89user  8.72system 0:30.82elapsed 83%CPU  444 sleep requested by int28
      0  18.65user  9.55system 0:30.78elapsed 91%CPU _NO_ 'sleep requested by ...'
    
    idle(0, 2, 0, "int28") and '$_debug = "-a+cw"' :
      1   0.90user  0.61system 0:33.99elapsed  4%CPU
      2   0.99user  0.68system 0:30.21elapsed  5%CPU
      5   1.35user  1.00system 0:29.99elapsed  7%CPU
     10   1.88user  1.60system 0:30.04elapsed 11%CPU
     30   4.05user  4.00system 0:30.01elapsed 26%CPU
    100   9.61user 10.30system 0:30.54elapsed 65%CPU
      0  13.56user 15.03system 0:30.37elapsed 94%CPU
    
    idle(0, 2, 0, "int28") and '$_debug = "-a+6cwg"' :
      1   1.23user  0.72system 0:33.55elapsed  5%CPU 3468 sleep requested by int2f_idle_magic
      2   1.46user  0.74system 0:30.81elapsed  7%CPU 3138 sleep requested by int28
      5   2.20user  1.15system 0:30.52elapsed 11%CPU 3133 sleep requested by int28
     10   3.63user  1.70system 0:30.29elapsed 17%CPU 3137 sleep requested by int28
     30   8.66user  4.35system 0:30.25elapsed 43%CPU 3095 sleep requested by int28
    100  12.54user  6.39system 0:30.60elapsed 61%CPU 1456 sleep requested by int28
      0  20.81user 10.84system 0:34.12elapsed 92%CPU _NO_ 'sleep requested by ...'
    
    idle(0, 1, 0, "int28") and '$_debug = "-a+cw"' :
      1   0.88user  0.56system 0:30.54elapsed  4%CPU
      2   1.03user  0.71system 0:30.05elapsed  5%CPU
      5   1.09user  0.80system 0:30.38elapsed  6%CPU
     10   1.38user  1.11system 0:30.21elapsed  8%CPU
     30   2.62user  2.45system 0:30.10elapsed 16%CPU
    100   6.53user  6.64system 0:30.06elapsed 43%CPU
      0  14.26user 15.45system 0:30.05elapsed 98%CPU
    
    idle(0, 1, 0, "int28") and '$_debug = "-a+6cwg"' :
      1   1.21user 0.71system 0:30.44elapsed  6%CPU 3135 sleep requested by int2f_idle_magic
      2   1.55user 0.75system 0:30.24elapsed  7%CPU 3135 sleep requested by int28
      5   1.74user 0.83system 0:30.55elapsed  8%CPU 3132 sleep requested by int28
     10   2.47user 1.29system 0:30.20elapsed 12%CPU 3135 sleep requested by int28
     30   5.01user 2.63system 0:30.27elapsed 25%CPU 3121 sleep requested by int28
    100  13.53user 6.80system 0:30.60elapsed 66%CPU 2960 sleep requested by int28
      0  19.00user 9.39system 0:30.54elapsed 92%CPU _NO_ 'sleep requested by ...'
    
     
  • Stas Sergeev

    Stas Sergeev - 2014-05-30

    10 looks most plausible from your figures.

    Docs are outdated; in fact, for many years
    only hogthreshold=1 was tuned with some care.
    1 and 0 are the expected values, the rest
    should be rarely used.

     
  • Andrew Bird

    Andrew Bird - 2014-05-31

    Hi both,
    Interestingly I saw this old commit in 1.2 release branch which suggests that hogthreshold might be negative in the future! Not sure if it ever got implemented, or what the semantics might be.

     
  • Stas Sergeev

    Stas Sergeev - 2014-05-31

    IIRC there was some discussion about an
    unconditional sleeps, aka cpu slowdown.
    Maybe it was supposed to be controlled
    with the negative hogthreshold values,
    but it was never implemented.
    dosbox is much better for slowdown things.

     

Log in to post a comment.

MongoDB Logo MongoDB