linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Smith <sos22@cam.ac.uk>
To: linux-c-programming@vger.kernel.org
Subject: Re: Mutual exclusion
Date: Sun, 9 Jun 2002 18:46:30 +0100	[thread overview]
Message-ID: <20020609174630.GA448@cam.ac.uk> (raw)
In-Reply-To: <20020609120501.A12543@whatever.local>

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]

> 	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,
sos22@cam.ac.uk.

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

  reply	other threads:[~2002-06-09 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-09 16:05 Mutual exclusion chuckw
2002-06-09 17:46 ` Steven Smith [this message]
2002-06-10 21:47   ` Detecting file changes? Christopher Quinn
2002-06-10 21:50     ` Billy O'Connor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020609174630.GA448@cam.ac.uk \
    --to=sos22@cam.ac.uk \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).