Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Threads

Author: Dann Corbit

Date: 18:49:19 04/06/99

Go up one level in this thread


On April 06, 1999 at 21:30:34, James Robertson wrote:

>I am thinking of making my program multithreaded to ease implementation of
>several things. But before I begin, I have several questions: first, if I have
>an input thread that just sits with cin, and my search thread is doing stuff in
>the background, will the search thread be slowed? Second, about locking and
>unlocking resources shared between threads; how is this usually done? If I just
>declare a variable, say
>
>bool locked = false;
>
>Can I "lock" and "unlock" resources by just:
No
[snip]

You manage threads and shared memory and things like that with system specific
API's or standard interfaces.

To prevent multiple writes, or a write while reading of a data object, you will
use either:
Semaphors
Mutexes
or
Critical Sections

For memory that is read by many threads or executables, you normally use shared
memory.

You can use system specific services.  For instance, with Microsoft Windows NT
or 95/98, you would use the Win32 API.  For UNIX systems, you would use POSIX
threads and services.  You could also use ACE (which is what I plan to do) which
allows transparent use across almost any system.  You will surely lose a hair of
performance, but what you gain is that for Cray, for RS/6000, for NT, for MVS,
all you do is recompile and you are done.
http://www.cs.wustl.edu/~schmidt/ACE.html



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.