Skip to contentSkip to conversation

Mutual exclusion

DISCUSSION [email protected] 4 participants 4 messages Jun 9, 2002 – Jun 10, 2002

lore
Share & tools
lore
#0 lore raw

Hello All,
What are the different types of Mutual exclusion primitives available
in linux? I know there is the pthread mutex and semaphores. Is there anything else?

Thanks Much,
Chuck

#1 lore raw
Quoted 3 lines

What are the different types of Mutual exclusion primitives available
in linux? I know there is the pthread mutex and semaphores. Is there anything else?

Off of the top of my head:

1) pthreads spinlocks
2) pthreads barriers
3) pthreads conditional variables
4) pthreads rwlocks
5) SysV semaphore sets
6) SysV message queues
7) fcntl file locks
8) flock file locks
9) You could probably do something with signals as well, if you're careful
10) Or with a load of pipes and suitable ingenuity
11) link() and the dnotify API, if you're feeling somewhat silly
12) flockfile()

These require varying degrees of cleverness to use, and the best one (as always) depends on what you're using it for. There are probably more if you look hard enough, as well.

Unless you have somewhat unusual needs, it's probably easiest to stick to pthreads mutexs and semaphores.

Steven Smith,
[email protected].

#2 lore raw

Detecting file changes?

Hello list.

Is there a way other than polling to detect when a file's contents change? I was hoping something like select(2).
Any ideas?

Thanks,
Chris

#3 lore raw

Re: Detecting file changes?

Quoted 1 line

From billy Mon Jun 10 16:51:33 2002

Date: Mon, 10 Jun 2002 22:47:21 +0100
From: Christopher Quinn <[email protected]>
X-Accept-Language: en-us, en
Sender: [email protected]
X-Mailing-List: [email protected]

Hello list.

Is there a way other than polling to detect when a file's contents change? I was hoping something like select(2).
Any ideas?

Thanks,
Chris

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Check out sgi_fam. This uses select to monitor file accesses. One source would be:

http://mirror.hiwaay.net/redhat/redhat/redhat-7.3-en/os/i386/SRPMS/fam-2.6.7-6.src.rpm

--
Billy O'Connor