Subject: Re: foo_init()s in main() [was: CVS commit: src/sys]
To: None <tech-kern@NetBSD.org>
From: None <email@example.com>
Date: 11/23/2005 09:58:33
On Tue, Nov 22, 2005 at 09:57:52AM -0800, Jason Thorpe wrote:
> I'd just like to state for the record that I don't like the FreeBSD
> SYSINIT stuff. It still requires a centralized list of "subsystems",
> and still explicitly encodes the order. So, now instead of looking
> in one place for the order of initialization, you have to look in a
> bunch of random places.
FreeBSD has chosen to enforce a global order of init hooks, which has both
advantages and disadvantages. The big pro is that the system is
relatively predictable. Introducing a new subsystem or hooking in
another entry has a low impact. The order within one level might not be
obvious or stable, but the bigger picture doesn't change.
The contra is of course, that a global initialisation order has to be
thought out, which is sometimes not optimal.
The alternative, which wouldn't be that difficult to implement (since it
is infact just a different sort function), would a full topological sort
of dependency entries. This is IMO much less stable, which is a bad
thing when trying to hunt down bugs in the system initialisation. It is
also more difficult to get right.
> I would much prefer we go with a lazy initialization scheme.
Initialisation on demand? I don't like that for most parts of the
system. It implies that the subsystems have either no non-preinitialised
global state (like most drivers) or a lot of additional checks. I think
it just moves responsibility.