Computer Chess Club Archives


Search

Terms

Messages

Subject: Need a little help with multithreaded programming

Author: Russell Reagan

Date: 11:25:09 12/27/01


I would like to try a multithreaded approach to writing my chess program, and I
would like a little help in understanding some concepts. I understand the basics
of multithreaded programming. I can start threads, setup data protection for
data shared between threads, etc. Basically, I know how to use threads and I can
implement them, I know how to implement data protection schemes (critical
sections, mutexes, etc.) but I don't know the proper use of those data
protection schemes.

I have done a lot of asking around, posting on other message boards, gone to the
library, and read some at my local bookstore, but I usually leave a little more
confused than when I started. A typical "learning" experience goes something
like this: I read about the need for data sharing protection, and then I read
about the implementation of critical sections. So far so good. Then I move on to
the next section and I read about mutexes, and I read about how to implement
those. I understand everything that I've read, but I don't understand which data
protection schemes I should use. In other words, I could implement a
multithreaded application using critical sections, and I could do it using
mutexes, and the other methods, but I don't know if I'm done after I get my
program working with only one of those schemes.

Are critical sections used for a certain problem, and mutexes used for another,
and semaphores used for yet another? Or are they all an attempted solution to
the same problem? And do I need to use more than one of these in my program, or
will one of these methods solve the problem? And if one will do, are there any
that would serve a chess program better than the others?

From what I gather, on a single processor machine, using only one of these
methods should work. But what new problems enter the scene on a multiprocessor
machine and what solutions exist for those new problems? I am currently on a
single processor machine, but I'd like to move to a multiprocessor machine in
the future, so I'd like to have the framework *basically* in place to allow for
a smooth transition.

Thanks for your help.

Russell



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