Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: POSIX threads

Author: Lance Perkins

Date: 18:39:48 07/05/05

Go up one level in this thread


You missed the point here. I never claimed that a shared resource is a single
memroy. Read again. Even on a single CPU you would need locks, mutexes,
semaphores, events, mailboxes, etc to synchronize. But to say that all you need
is a single-cpu to "test" your multi-threaded app is too naive of a statement.

Most newbie programmers think that because they have used mutexes to guard their
code segments, that they are already safe. Until the test team runs their code
on multi-cpu machines and they fail misserably.

Ever heard of a reputable software company that tries to save money and never
buys multi-cpu machines for testing their multi-threaded app? If you find one,
they would probably be out of business soon.

---

On July 05, 2005 at 14:54:38, Steven Edwards wrote:

>On July 05, 2005 at 05:02:54, Lance Perkins wrote:
>
>>Not true.
>>
>>Testing a multi-threaded app on a single-cpu machine is bogus. Its very easy to
>>write a multi-threaded app. Its a no brianer. But to be sure that it actually
>>works on a multi-cpu machine, you have to test it on one.
>>
>>On a single-cpu machine, the threads never run in parallel. A shared resource
>>will never be accessed simultaneously.
>
>Wrong.  You are limiting the concept of a shared resource to a single memory
>access.  A shared resource may be an entire table or even an executable object.
>Without protection by, say, a POSIX mutex, a program on a single processor
>machine running multiple threads may fail.



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.