Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: is the

Author: Robert Hyatt

Date: 13:33:03 07/24/98

Go up one level in this thread


On July 24, 1998 at 14:25:32, Tom Kerrigan wrote:

>On July 24, 1998 at 11:54:48, Roberto Waldteufel wrote:
>
>>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.
>
>No, you still don't get it.
>
>Only backwards "operating systems" like Windows 3.1 and the Mac OS "allocate
>RAM."
>
>Both Windows 95 and UNIX use virtual memory. RAM is divided into thousands of
>pages and the pages are used as cache lines to this virtual memory. The idea is
>exactly the same for both operating systems. There may be minor differences
>between the policies to determine which addrseses in virtual memory are used and
>which pages are swapped in and when.
>
>It sounds like your program runs fine under Windows after an initial delay. It's
>almost silly to think that one system would have a "big advantage" over another
>if the program runs fine under both...
>
>Cheers,
>Tom


One nit:  the term "virtual memory" is vague and generally applies to a program
that has an address space that won't fit into real memory.  In unix there are
three issues:

1.  swapping.  A process can be swapped to disk, in its entirety, if that memory
is needed by another process and the priorities allow it.  For swapping in unix,
however, it is all or none, except that if a process is swapped while waiting on
I/O, the I/O buffers are obviously not swapped.

2.  paging.  A process can exist totally in RAM, or partially in RAM and
partially on disk.  This can be more complicated to explain, but the executable
instructions exist in the executable file and are paged in from there as needed,
and when they are replaced in memory by other stuff, they get paged in again
from the executable.  Dynamically allocated and/or unitialized memory are just
allocated as needed...  when the program touches such a page in its address
space, the system removes a page from the free (or modified page list if forced
to when the free list is empty) and plugs it into the address space of the
program, at the point where it is needed.  From then on, this page will either
exist in RAM, or will exist on the swapping device if it has been removed from
RAM.

In UNIX, there generally isn't a lot of paging I/O at program startup, so long
as there is enough free RAM to meet the requirements of the application.  If
not, unix will first try to free up filesystem buffer cache to satisfy the
RAM
requirements of the process.  If it can't it will elect to either kick out
other processes (swap them out if they have been blocked for a reasonable length
of time); or it will steal part of their RAM (global page replacement policy in
most current unix systems); or it will choose to page the current app, replacing
pages that haven't been used recently with pages that are needed right now.

Bottom line is that *any* system ought to behave like this, and I can't imagine
Win95 not doing so, based on my infrequent interactions with it.  But it might
not be nearly as "smart" as unix overall.  In any case, I can start Crafty on my
P6 and get the first move before a single second elapses on the clock.  Many
complain about Crafty on Win95, but when they throttle back the hash table size,
the problem seems to go away, at least the reported 10 second delay to get
started becomes 1 or 2 seconds instead.




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.