Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion recursive mutexes
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Giancarlo Niccolai  
View profile  
 More options May 15 2005, 1:24 pm
Newsgroups: comp.programming.threads
From: Giancarlo Niccolai <searchfo...@ingoogle.com>
Date: Sun, 15 May 2005 13:24:16 -0400
Local: Sun, May 15 2005 1:24 pm
Subject: Re: recursive mutexes

Uenal Mutlu wrote:

>> In all the years I've been programming, I have never used a recursive
>> mutex (except in Java, but that's another story).

> Then you must have overlooked their real value.

Sorry if I jump in late in the discussion, but I believed that David was
enough to fix this mental bug that you have encountered.

IMHO usage of recursive mutexes is generally an immediate and incontestable
proof of poor design.

It's not a matter of multithreading theoremes, it's a matter of parallel
activity design. Coordination is an high level activity in any parallel
process, be it coordination between firm divisions, production chains,
information processing or simply programming.

You don't want a magazine clerk of the production function to coordinate
with a magazine clerk of the provisions. The production manager will raise
the phone and talk with the provision manager (or the other way around)
when they need coordination. And believe me, they both know when they take
up the phone (lock) and when they put it down (unlock), and it's unlikely
that they can raise the phone twice without lowering it first.

Same for threads. When threads need coordination, a well designed system
will put this coordination in a place that each thread can perfectly
manage, and will make sure that coordination will 1) take less time and
computational power as possible and 2) nothing else will be done during
coordination step.

Locking a mutex means your agents are phoning each other. It's not polite to
have listener(s) hanging because you must do something while phoning them,
even if this something is somehow a recursive function call.

Locking for everything else except coordination (that is, inter-thread
communication) is bad design. Not just bad programming, but bad
understanding of parallel processing logic.

Bests,
Giancarlo Niccolai.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.