Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How To Fairly Allocate Resources Between 2 multitasking Chess Progra

Author: fca

Date: 11:39:35 08/12/98

Go up one level in this thread


On August 12, 1998 at 13:48:32, Robert Hyatt wrote:

>On August 12, 1998 at 11:13:06, fca wrote:
>
>>If multitasking two chess programs on one PC, and playing a game between
>>them, how does one "fairly" allocate resources between them?
>>
>>I accept there is no question of properly deducing playing strength in such a
>>scenario.  That is NOT the objective, therefore.
>>
>>0. What does "fairly" mean?
>>
>>1. RAM?
>>
>>2. CPU %?
>>
>>3. Idle / background priority?
>>
>>4, Thinking Time set on program?
>>
>>and especially
>>
>>5. Should permanent brain be switched off on one or both programs?
>>
>>Ideas on how to arrive at the answers, please, or better still - the answers
>>themselves. :-)

>This comes up so often.  :)

Yup.  But usuallly in a way that is less complete, or confusing to the
(relative) newbie.  I am trying to get a semi-structured response, so the
result is of help to the interested...  Who knows, I might learn something too.

>The biggest problem is that chess programmers tend to write code as though their
>program is the only thing running on the machine.  I remember an early version
>of Crafty playing against an older version of ChessMaster, and crafty was
>getting eaten alive.  When I would play over the games, I could never get it to
>make some of the really bad moves, and asked for the log files (this was back
>when I was searching 30K nodes per second on a P5/133mhz machine).  The games
>were being run on an older 486, which I knew was going to be probably 5x slower,
>so I was expecting 4-6K nodes per second.  I was getting about 1K.  What we
>found was that the old version of ChessMaster had an input loop where rather
>than doing a normal read, it just continually asked "has a key been pressed?
>NO.  has a key been pressed?  NO." over and over, and burning cpu cycles even
>when it wasn't thinking.  Which meant that even if you turned off thinking on
>the opponent's time, CM was using 1/2 of the cpu cycles when crafty was
>thinking, but when crafty was "waiting" it did a simple read() which blocked it
>until CM made a move and the operator entered it.

Surely an innocent programming slip  ;-)

>Bottom line:  two programs on a single machine is always a bad idea.

Agreed.  But Mr Newbie has only one computer and wants to play two different
programs against eachother, not autoplay the program.  Buy Fritz and have
different engines is one possible answer.  But if one of the programs he wants
to play is Rebel, or Genius, hell will have frozen over first before he can run
their engines in Fritz.

So, bad idea or not, he is trying to get the best play in his restricted world.

>There can be interactions like the above where one hogs the CPU
>without your knowing, or where one hogs memory and makes the
>other page at the beginning of each move.

Surely.

So, how does Mr Newbie best combat this?

In practical terms, how can he control RAM usage where the (greedy) program does
not allow hash etc. table size to be selected?  What method to grab RAM, load
program 1, release RAM, load program 2.

>Or any of several other things, which can (but don't always) affect
>the outcome of games.

>I used to do lots of crafty vs crafty and crafty vs gnuchessx testing on a
>single CPU, because in unix, this sort of I/O "polling" is generally not done,
>and it can work o.k.

In my 68000 world where multi-tasking has been a la mode since the early 1980s,
unfriendly = redundant polling would be regarded as an insult to co-existing
stuff.

>But I also knew that running a match may well hurt one
>more than the other, if one does a better job of predicting the other's moves,
>because it won't get to take advantage of that...

Agreed, and part of another response.

IF there is no way of switching permanent brain off on (say) one program, would
you advise differential thinking time being set on the programs?  In what
(other) circumstances would differential thinking time be the best bodge?

Also, let us say doubling thinking time for both programs A and B from say 40/1
to 40/2 produces an x ELO grading improvement *in each* when used in its own
machine, permanent brain off.

If permanent brains are on, and each program is getting 50% of CPU time whether
or not it is on move, and the thinking time of A is doubled from 40/2 to 40/4,
what would be its *estimated* performance gain (bearing in mind we have also
increased the 'background' time for B) vs B in a shared environment?  If
assumptions need be made about the accuracy of guessing opponent's move, let us
assume that both A and B guess right 50% of the time (irrespective of time
allocation).

Kind regards

fca





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.