bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthread_barrier type and functions


From: Mohammad Akhlaghi
Subject: Re: pthread_barrier type and functions
Date: Mon, 09 Mar 2015 11:33:24 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

Hi Bruno,

Thanks for introducing the two cases, it is very interesting. I understand the first option (glibc's implementation) better, but if the second is a more fundamental approach maybe that should be used. As long as all the pthread_barrier functions become available.

I am an astronomy PhD student and have not officially had any computer science courses (although I am very interested to learn, as I have until now). I will definitely read the "Little book on Semaphores" to understand them better.

Thank you for the links,
Mohammad

On 03/08/2015 08:51 PM, Bruno Haible wrote:
Mohammad Akhlaghi wrote:
I have made extensive use of the pthread_barrier_* types and functions
for the parallel processing parts of gnuastro. But I found out Gnulib
doesn't include them. I wanted to see if it would be possible for you to
include these in the Gnulib version of pthread. Using a pthread_barrier
is simpler than using a mutex and condition variable together when the
jobs are completely independent.
Which one of these two implementation approaches would be better:

a) using the same design as glibc,
    
https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/DESIGN-barrier.txt;hb=HEAD
    possibly with an additional lock for the atomic increment?

b) using two semaphores, as in
    
http://stackoverflow.com/questions/6331301/implementing-an-n-process-barrier-using-semaphores
    (possibly replacing the second semaphore with a pthread_cond_t ?)

[I'm not going to implement it. Just trying to give food for thought.]

Bruno







reply via email to

[Prev in Thread] Current Thread [Next in Thread]