Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Aug 2004 01:12:05 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Petri Helenius <pete@he.iki.fi>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: sharing mutexes
Message-ID:  <20040830081205.GE28061@odin.ac.hmc.edu>
In-Reply-To: <4132DBBB.4020008@he.iki.fi>
References:  <4132C1CA.8070602@he.iki.fi> <20040830071707.GB28061@odin.ac.hmc.edu> <4132DBBB.4020008@he.iki.fi>

next in thread | previous in thread | raw e-mail | index | archive | help

--MIdTMoZhcV1D07fI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 30, 2004 at 10:48:11AM +0300, Petri Helenius wrote:
> Brooks Davis wrote:
>=20
> >That depends on what you mean.  You can use sysv semaphores between
> >processes, but their API is problematic in some applications.
> >
> >Could you explain what you want to do in more detail?
> >=20
> I have multiple processes running threaded applications which would like=
=20
> to do 64bit wide atomic arithmetic, which if I understand correctly can=
=20
> only be achieved either via IPC (having a master process to do all the=20
> stuff) or sharing a mutex somehow. And as far as I understand, mutexes=20
> are process-local by default.

If you actully have a multi-process, multi-threaded application doing
writes to shared memory, they you probably need to use sysv semaphores
at this point since I think that's our only only portable, multi-process
locking mechanism at this point.  The code for POSIX sempahores seems to
indicate that you can use them in multiple processes if they are created
before a fork, but I've never tried that.  If you have a multi-threaded
application which is not multi-process, sysv semaphores or posix
semaphores will work.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--MIdTMoZhcV1D07fI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBMuFUXY6L6fI4GtQRAptnAJ0V3rxYB71U8VTloBgRyQ5ynJcIKgCg3iVL
mW+nVHBgSoC51/oMyb/61xw=
=H32O
-----END PGP SIGNATURE-----

--MIdTMoZhcV1D07fI--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040830081205.GE28061>