Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2000 07:27:37 +0000
From:      Tony Finch <dot@dotat.at>
To:        Matt Dillon <dillon@earth.backplane.com>
Cc:        Alfred Perlstein <bright@wintelcom.net>, Kirk McKusick <mckusick@mckusick.com>, arch@FreeBSD.ORG, net@FreeBSD.ORG
Subject:   Re: patch to cleanup inflight desciptor handling.
Message-ID:  <20001214072737.A92196@hand.dotat.at>
In-Reply-To: <200012140125.eBE1Pbi89951@earth.backplane.com>
References:  <200012131852.KAA17423@beastie.mckusick.com> <200012132106.eBDL6Sg86570@earth.backplane.com> <20001213141917.Q16205@fw.wintelcom.net> <20001213145341.S16205@fw.wintelcom.net> <20001213153649.T16205@fw.wintelcom.net> <200012140125.eBE1Pbi89951@earth.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Matt Dillon <dillon@earth.backplane.com> wrote:
>
>    No waste at all, Alfred, the file descriptor passing code had been
>    broken for over 10 years precisely because of its complexity.  Rewriting
>    the GC to be more efficient essentially requires using deep graph theory
>    to locate isolated loops of arbitrary complexity.

Most efficient GCers don't involve much graph theory (the notable
exception is concurrent collectors); instead they rely on various
strategies to drastically reduce the proportion of the arena that they
need to examine in most GC runs. In principle mark-sweep collectors
are as simple as they get, but unp_gc suffers from the interaction
with refcounting.

You can use the idea of scanning less of the arena to improve unp_gc
as follows. I suggest that you keep two additional lists: one of open
unix domain sockets, and one of in-flight sockets. Instead of the
existing breadth-first search of the whole file table at the start of
unp_gc, it should first clear the mark on each descriptor on the
in-flight list, then do a depth-first search of all the descriptors
reachable from the unix domain sockets list, marking each one. The
loop after the big comment in unp_gc should then scan the in-flight
list looking for unmarked descriptors instead of the whole file table.
The descriptor freeing loops stay as they are now.

I think this should solve the problem at hand, i.e. a lock being held
on an important resource while something complicated is being done;
instead you would hold locks on two much less important lists (the
unix domain list and the in-flight list).

>    p.s. many object oriented language garbage collectors have the same
>    problem.  create object A, create object B, A references B, B references A,
>    drop A, drop B.  A and B still have references and don't get cleaned up.
>    Fun.

Most modern GCers don't use reference counting partly for that reason,
and partly because the overhead of maintaining reference counts is too
great.

Tony.
-- 
f.a.n.finch    fanf@covalent.net    dot@dotat.at
"Well, as long as they can think we'll have our problems.
But those whom we're using cannot think."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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