Inter Process Synchronisation

Niall Douglas s_sourceforge at nedprod.com
Wed Jun 6 21:16:08 UTC 2012


On 6 Jun 2012 at 9:52, Resit Sahin wrote:

> I thought i can ask inter-process related issues in this list. Which 
> list is appropriate for such issues?

This list is for FreeBSD specific threading issues. For example, if 
FreeBSD's POSIX threads implementation has some weird behaviour not 
seen on other POSIX implementations.

It isn't for general POSIX programming questions. Yours is a general 
programming question, not even POSIX related really.

There are many good books on threaded programming.

> I did not get why should i need to create a new copy of the stats each 
> time?

If what I said didn't make sense you then it's probably not important 
to your use case. If you want it to make sense, look up cache 
coherency overheads and bus snoop protocols. I vaguely remember once 
seeing an okay Wikipedia page on the topic.

> I wanted to post in this list because i want to learn if there are other 
> ways to synchronise between processes without using semaphores. As far 
> as i understand from your answer i can use atomic variables between 
> multiple processes. Do you mean this 
> <http://www.freebsd.org/cgi/man.cgi?query=atomic_add&apropos=0&sektion=0&manpath=FreeBSD+9.0-RELEASE&arch=default&format=html> 
> with atomic operations?

C11 and C++11 have a perfectly good atomics library. Failing that, 
GCC, Clang and MSVC all have their own atomics libraries which do 
what C11 and C++11 do but with different function names. Failing 
that, all modern assemblers have atomic instructions.

Niall

-- 
Technology & Consulting Services - ned Productions Limited.
http://www.nedproductions.biz/. VAT reg: IE 9708311Q.
Work Portfolio: http://careers.stackoverflow.com/nialldouglas/





More information about the freebsd-threads mailing list