[H-GEN] pthreads + communication in concurrent environments

Ben Carlyle benc at foxboro.com.au
Thu Aug 26 01:33:09 EDT 1999


[ Humbug *General* list - semi-serious discussions about Humbug and
Unix-related topics. ]

Ray Wrote:
> > You do not really want to do this. If you are using threads I would
> > suggest have a global variable you set in the signal handler and another
> > thread which periodically polls this variable and performs appropriate
> > actions.

and Colin Ward replied:
>   Pardon me, as I am a newcomer around here, but you should *never* use
> variables for signalling that structures are safe to access.  You simply
> cannot be sure that the access to the variable is atomic, especially in
> this day and age of programming in high level platform-neutral
> languages.  Who knows what code is generated to read or write a variable
> on an X86, PPC or 68k CPU?  The problems are worse if you use a
> multi-CPU machine, where even a single assembly instruction is not
> guaranteed to be atomic.

I think Ray was talking about something different, relating to general
signal hander use rather than this specific example, but I'll let him
defend his own turf.  I'd like to put in my two cents with a sligtly
different speel.  I find the use of mutexes, semaphores, and even
montors quite primative.  It's my opinion that in all but the most
critical real-time systems that these primitaves do more harm than
good.  It's easy to get things wrong, and "accidently" fail to protect
your data correctly, or cause lockups in strange an unual ways.  The
interfaces between threads are complicated, hard to understand, and
hard to test.  I perfer a distributed programming environment based
on message passing, such as Ada's rendezvous system.

I haven't done a lot of large-scale development of concurrent systems,
but I have seen a few.  I've tutored a concurrency subject, and done
a thesis on testing of the darn things for my honours, so I do have
some background in the field however y knowledge is mostly from
proprietry systems, or Ada programs.

so my quesions follow:  Has anyone on the list had good/bad experiences
with various Unix/posixish message passing systems, particularly in
contrast to systems based on shared memory and synchronisation
primatives?  Has anyone had a decent bite of the pvm archetecture,
or posix message passing?  How well is the posix version supported
across Unixes + NT? (I've heard it's a relatively new addition to the
standard).


Benjamin.

--
This is list (humbug) general handled by majordomo at lists.humbug.org.au .
Postings only from subscribed addresses of lists general or general-post.



More information about the General mailing list