Re: locking p_children, p_sibling and p_pptr

Bill Studenmund <[email protected]> Fri, 7 Nov 2003 12:37:43 -0800
Newsgroups gmane.os.netbsd.devel.smp
Message-ID <[email protected]>
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.
> 
> 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_reparent()
> unless a global lock is used.
> 
> 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 
sources of prior art on this. What have they done?

Take care,

Bill
signature.asc (application/pgp-signature, 186 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

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