Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #2104 > unrolled thread

Distributed Reader-Writer Mutex by Dmitry Vyukov

Started by"aminer" <aminer@videotron.ca>
First post2012-08-25 18:45 -0500
Last post2012-08-25 19:56 -0500
Articles 5 — 2 participants

Back to article view | Back to comp.programming


Contents

  Distributed Reader-Writer Mutex by  Dmitry Vyukov "aminer" <aminer@videotron.ca> - 2012-08-25 18:45 -0500
    Re: Distributed Reader-Writer Mutex by  Dmitry Vyukov "aminer" <aminer@videotron.ca> - 2012-08-25 19:19 -0500
      Re: Distributed Reader-Writer Mutex by  Dmitry Vyukov "aminer" <aminer@videotron.ca> - 2012-08-25 19:23 -0500
    Re: Distributed Reader-Writer Mutex by  Dmitry Vyukov Patricia Shanahan <pats@acm.org> - 2012-08-25 16:47 -0700
      Re: Distributed Reader-Writer Mutex by  Dmitry Vyukov "aminer" <aminer@videotron.ca> - 2012-08-25 19:56 -0500

#2104 — Distributed Reader-Writer Mutex by Dmitry Vyukov

From"aminer" <aminer@videotron.ca>
Date2012-08-25 18:45 -0500
SubjectDistributed Reader-Writer Mutex by Dmitry Vyukov
Message-ID<k1bkhs$uk8$1@dont-email.me>

Hello all;

I have loolked at the Distributed Reader-Writer Mutex by Dmitry Vyukov, look 
at

http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex


and i have looked at it and i think there is a problem with this method, 
cause look
at the write lock function:

int         distr_rw_mutex_wrlock           (distr_rw_mutex_t* mtx)
{
    int                     i;
    for (i = 0; i != mtx->proc_count; i += 1)
        pthread_rwlock_wrlock(&mtx->cell[i].mtx);
    return 0;
}


What is wrong with it ? suppose two or more writers wants to lock this 
distributed rwlock
there is a possibility of a deadlock.

So i think you have to use a critical section around the for loop to be able 
to lock
all the rwlocks at the same time to avoid the deadlock problem..


Am i correct or not ?


Thank you,
Amine Moulay Ramdane.




[toc] | [next] | [standalone]


#2105

From"aminer" <aminer@videotron.ca>
Date2012-08-25 19:19 -0500
Message-ID<k1bmhr$e9n$1@dont-email.me>
In reply to#2104
I wrote:
> So i think you have to use a critical section around the for loop to be 
> able to lock
> all the rwlocks at the same time to avoid the deadlock problem..


I mean  you have to use a critical section around the for loop to be able
to lock all the rwlocks atomicly  to avoid the deadlock problem..





Thank you,
Amine Moulay Ramdane.



"aminer" <aminer@videotron.ca> wrote in message 
news:k1bkhs$uk8$1@dont-email.me...
>
>
> Hello all;
>
> I have loolked at the Distributed Reader-Writer Mutex by Dmitry Vyukov, 
> look at
>
> http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
>
>
> and i have looked at it and i think there is a problem with this method, 
> cause look
> at the write lock function:
>
> int         distr_rw_mutex_wrlock           (distr_rw_mutex_t* mtx)
> {
>    int                     i;
>    for (i = 0; i != mtx->proc_count; i += 1)
>        pthread_rwlock_wrlock(&mtx->cell[i].mtx);
>    return 0;
> }
>
>
> What is wrong with it ? suppose two or more writers wants to lock this 
> distributed rwlock
> there is a possibility of a deadlock.
>
> So i think you have to use a critical section around the for loop to be 
> able to lock
> all the rwlocks at the same time to avoid the deadlock problem..
>
>
> Am i correct or not ?
>
>
> Thank you,
> Amine Moulay Ramdane.
>
>
>
>
> 

[toc] | [prev] | [next] | [standalone]


#2106

From"aminer" <aminer@videotron.ca>
Date2012-08-25 19:23 -0500
Message-ID<k1bmp5$fbb$1@dont-email.me>
In reply to#2105
"aminer" <aminer@videotron.ca> wrote in message 
news:k1bmhr$e9n$1@dont-email.me...
>
> I wrote:
>> So i think you have to use a critical section around the for loop to be 
>> able to lock
>> all the rwlocks at the same time to avoid the deadlock problem..
>
>
> I mean  you have to use a critical section around the for loop to be able
> to lock all the rwlocks atomicly  to avoid the deadlock problem..


Sorry for my english: i mean atomically.



Thank you,
Amine Moulay Ramdne.



>
>
>
>
>
> Thank you,
> Amine Moulay Ramdane.
>
>
>
> "aminer" <aminer@videotron.ca> wrote in message 
> news:k1bkhs$uk8$1@dont-email.me...
>>
>>
>> Hello all;
>>
>> I have loolked at the Distributed Reader-Writer Mutex by Dmitry Vyukov, 
>> look at
>>
>> http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
>>
>>
>> and i have looked at it and i think there is a problem with this method, 
>> cause look
>> at the write lock function:
>>
>> int         distr_rw_mutex_wrlock           (distr_rw_mutex_t* mtx)
>> {
>>    int                     i;
>>    for (i = 0; i != mtx->proc_count; i += 1)
>>        pthread_rwlock_wrlock(&mtx->cell[i].mtx);
>>    return 0;
>> }
>>
>>
>> What is wrong with it ? suppose two or more writers wants to lock this 
>> distributed rwlock
>> there is a possibility of a deadlock.
>>
>> So i think you have to use a critical section around the for loop to be 
>> able to lock
>> all the rwlocks at the same time to avoid the deadlock problem..
>>
>>
>> Am i correct or not ?
>>
>>
>> Thank you,
>> Amine Moulay Ramdane.
>>
>>
>>
>>
>>
>
> 

[toc] | [prev] | [next] | [standalone]


#2108

FromPatricia Shanahan <pats@acm.org>
Date2012-08-25 16:47 -0700
Message-ID<eImdnZsJT9u4-aTNnZ2dnUVZ_rqdnZ2d@earthlink.com>
In reply to#2104
On 8/25/2012 4:45 PM, aminer wrote:
> Hello all;
>
> I have loolked at the Distributed Reader-Writer Mutex by Dmitry Vyukov, look
> at
>
> http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
>
>
> and i have looked at it and i think there is a problem with this method,
> cause look
> at the write lock function:
>
> int         distr_rw_mutex_wrlock           (distr_rw_mutex_t* mtx)
> {
>      int                     i;
>      for (i = 0; i != mtx->proc_count; i += 1)
>          pthread_rwlock_wrlock(&mtx->cell[i].mtx);
>      return 0;
> }
>
>
> What is wrong with it ? suppose two or more writers wants to lock this
> distributed rwlock
> there is a possibility of a deadlock.
>
> So i think you have to use a critical section around the for loop to be able
> to lock
> all the rwlocks at the same time to avoid the deadlock problem..
>
>
> Am i correct or not ?

The text explanation on the referenced web page says 'No additional
synchronization between writers is required, writers acquire the mutexes
in the same order (from 0 to P-1), so ownership over mutex 0 basically
determines who is the "current" writer (all other potential writers are
parked on mutex 0).'

Do you disagree with that explanation? If so, could you describe a
deadlock scenario that takes into account the fixed order of acquisition?

Patricia

[toc] | [prev] | [next] | [standalone]


#2109

From"aminer" <aminer@videotron.ca>
Date2012-08-25 19:56 -0500
Message-ID<k1bomr$on4$1@dont-email.me>
In reply to#2108
Patricia Shanahan wrote:
> The text explanation on the referenced web page says 'No additional
> synchronization between writers is required, writers acquire the mutexes
> in the same order (from 0 to P-1), so ownership over mutex 0 basically
> determines who is the "current" writer (all other potential writers are
> parked on mutex 0).'



You are absolutly right.


Thank you,
Amine Moulay Ramdane.




"Patricia Shanahan" <pats@acm.org> wrote in message 
news:eImdnZsJT9u4-aTNnZ2dnUVZ_rqdnZ2d@earthlink.com...
> On 8/25/2012 4:45 PM, aminer wrote:
>> Hello all;
>>
>> I have loolked at the Distributed Reader-Writer Mutex by Dmitry Vyukov, 
>> look
>> at
>>
>> http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
>>
>>
>> and i have looked at it and i think there is a problem with this method,
>> cause look
>> at the write lock function:
>>
>> int         distr_rw_mutex_wrlock           (distr_rw_mutex_t* mtx)
>> {
>>      int                     i;
>>      for (i = 0; i != mtx->proc_count; i += 1)
>>          pthread_rwlock_wrlock(&mtx->cell[i].mtx);
>>      return 0;
>> }
>>
>>
>> What is wrong with it ? suppose two or more writers wants to lock this
>> distributed rwlock
>> there is a possibility of a deadlock.
>>
>> So i think you have to use a critical section around the for loop to be 
>> able
>> to lock
>> all the rwlocks at the same time to avoid the deadlock problem..
>>
>>
>> Am i correct or not ?
>
> The text explanation on the referenced web page says 'No additional
> synchronization between writers is required, writers acquire the mutexes
> in the same order (from 0 to P-1), so ownership over mutex 0 basically
> determines who is the "current" writer (all other potential writers are
> parked on mutex 0).'
>
> Do you disagree with that explanation? If so, could you describe a
> deadlock scenario that takes into account the fixed order of acquisition?
>
> Patricia
>
>
> 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming


csiph-web