Computer Chess Club Archives




Subject: Re: is the

Author: Roberto Waldteufel

Date: 08:54:48 07/24/98

Go up one level in this thread

On July 24, 1998 at 09:28:26, Robert Hyatt wrote:

>On July 24, 1998 at 08:06:59, Tom Kerrigan wrote:
>>On July 23, 1998 at 19:39:40, Roberto Waldteufel wrote:
>>>the graphics overhead of Windows. When there are no other applications open, it
>>>seems strange to me that Windows does not automatically allocate RAM instead of
>>>slow-access disc space. I could understand it if I were multitasking other
>>No, you missed the point.
>>Windows does not allocate RAM. It allocates memory space. It probably does some
>>work to make sure that a lot of the memory allocated is already in RAM, but when
>>you allocate 40MB and you only have 64MB RAM, that's a very hard thing to do.
>>That's why you see so much swapping.
>however, if the memory management is done *right* then active programs page in,
>inactive programs page out, and the paging stops, assuming (a) the active
>program can actually fit into real memory and (b) that there are not more active
>programs than can actually fit into real memory.  Playing chess should have one
>compute-bound process and the rest should slowly "go away" to disk.
>in any case, the "paging" should be a flurry as most people see when they ask
>"Why does crafty take 10 secs to make the first book move, and then  0 seconds
>for the next 20 on my win95 machine, while on your linux box it can make the
>first 20 moves in 0 seconds?"
>Unix (linux) has to page in every page of executable code one time, as it is
>referenced by the program during execution.  For non-initialized data, there is
>no paging I/O at all...  it just allocates pages *as they are referenced and not
>before* and gives them to the program via the memory management hardware map.

Hi  Bob,

If I understand you correctly, Unix/Linux OS allocates program memory in RAM,
but Windows95 only allocates virtual memory that is on disc and is not swapped
into RAM until it is used? That would seem to be a big advantage over the
Windows method for a chess program.

When Crafty runs under unix or linux, the hash table is allocated in RAM
straight away, but what is the exact sequence of events under Windows95? Do you
do anything in your program code to make Crafty pause on the first book move
while the swapping takes place, or does Windows handle that by itself? I found
that no swapping was happenning at all while the user was prompted to choose
which colour pieces he wants, but it starts with a vengence as soon as the
search engine gets going, which doesn't happen until a real search is underway,
by which time it is too late.

I have recently implemented a rather clumsy work-around which seems to help.
Before prompting the user for colour of pieces, I store zero in all the hash
table records. This is of course completely unnecessary for the program
algorithm, since the arrays are automatically initialised to zero without any
program code, but at least it gets the swapping in done before the game begins.
I don't like this approach - do you know of a better way?

Best wishes

This page took 0.03 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.