Subject: Re: locking p_children, p_sibling and p_pptr
To: David Laight <david@l8s.co.uk>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-smp
Date: 11/07/2003 12:37:43
--VrqPEDrXMn8OVzN4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Nov 05, 2003 at 02:19:51PM +0000, David Laight wrote:
> My initial thought was that I could use the p_lock field of the
> parent to control the p_children/p_sibling list.  However I couldn't
> decide whether to allow the p_lock to be grabbed parent then child or v.v.
> Some code needed it one way, and some the other.
>=20
> However digging deeper I realised that p_pptr cannot be followed unless
> the same lock is held.  This makes it very tricky [1] to code proc_repare=
nt()
> unless a global lock is used.
>=20
> The real 'fun' starts when you realise that a process, its real parent,
> and a process tracing it could all be in sys_exit1() at the same time
> (given the big_lock has been killed).

Both FreeBSD (based on Jason's comments) and Solaris probably are good=20
sources of prior art on this. What have they done?

Take care,

Bill

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQE/rAKXWz+3JHUci9cRAi2XAJ9h2OPvvl+uWkRLaql2PuYlSxEangCglDhA
g+3Q9wQc2OgdreoPq8mQ6FA=
=H+Ux
-----END PGP SIGNATURE-----

--VrqPEDrXMn8OVzN4--