From owner-freebsd-threads@FreeBSD.ORG Mon Aug 30 08:09:31 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F389216A4CE for ; Mon, 30 Aug 2004 08:09:30 +0000 (GMT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id D593E43D1F for ; Mon, 30 Aug 2004 08:09:30 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id i7U8C5MP005315; Mon, 30 Aug 2004 01:12:05 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id i7U8C5Rr005314; Mon, 30 Aug 2004 01:12:05 -0700 Date: Mon, 30 Aug 2004 01:12:05 -0700 From: Brooks Davis To: Petri Helenius Message-ID: <20040830081205.GE28061@odin.ac.hmc.edu> References: <4132C1CA.8070602@he.iki.fi> <20040830071707.GB28061@odin.ac.hmc.edu> <4132DBBB.4020008@he.iki.fi> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MIdTMoZhcV1D07fI" Content-Disposition: inline In-Reply-To: <4132DBBB.4020008@he.iki.fi> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu cc: freebsd-threads@freebsd.org Subject: Re: sharing mutexes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2004 08:09:31 -0000 --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--