Author: Tord Romstad
Date: 01:59:11 01/20/06
Go up one level in this thread
On January 19, 2006 at 19:08:31, Dann Corbit wrote: >With a thread, every write to a global or static object MUST be gated with a >critical section or some such operation to prevent a crash. > >With a process, everyone can read and write to their own copy of global data >objects because they are not shared. Of course, but as long as the objects are not shared, I don't see any reason to use global data objects for them at all. The only global data I have which is written to during the search is the various hash tables, which should obviously be shared between all processes (or threads). >For example, with: >static learn_entry_t LearnTable[NUM_OF_LEARN_ENTRIES]; > >In a process, you can read and write to LearnTable with impunity. > >In a threaded program, you will have to ensure that only one thread writes to it >at the same time. In this particular case, it is very simple. I only write to this table at the root, and only one thread (the main thread) will ever write to it. The real (but managable, I hope) problems are the transposition table, the pawn hash table, the eval hash table and the material hash table. >The same is true for every single static or global variable that is not const. >That is why I was decorating some of your public symbols with const. In case >you want to make a threaded version some day, it will make the identification of >effort easier. In case it is not clear: I have no plans of ever writing a parallel version of Glaurung 1.x. My current code base has grown too big, ugly and unwieldy, and a major rewrite is long overdue. Tord
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.