Upstart

Scott James Remnant scott at ubuntu.com
Fri Mar 5 22:38:28 UTC 2010


On Fri, 2010-03-05 at 14:50 -0600, Patrick Goetz wrote:

> > D-Bus is used to communicate with the init daemon, and one of the method
> > calls you may make is to emit an event.  The event name is simply a
> > string, and the arguments an array of strings.  There's no need to
> > configure Upstart to accept certain events, you just make them up as you
> > go along.
> > 
> 
> Thanks for the detailed response, this is all starting to make sense. 
> So if service Z can't start until services A,B, and C have already 
> started the /etc/init/Z.conf file would contain the line:
> 
>    start on (A started and B started and C started)
> ?
> 
We don't tend to describe it that way.

We say that "service Z should be started as a result of services A, B
and C having been started".

(Because a sysadmin can always come along and run "start Z" by
themselves)

> And if D alternatively replaces A and C, then this becomes
> 
>    start on ((A started and B started and C started) or
>              (B started and D started))
> ?
> 
Yes.

> One last question. I'm curious about the technical details of how this 
> is implemented; i.e. what blocks Z until A,B, and C have started?  Does 
> upstart or some process simply make a list of /\/etc\/init\/(.+)\.conf/ 
> and then poll through the list in a loop looking to see if the 'start 
> on' conditions have already been met => send a startup $1 signal to 
> init, remove $1 from the list whenever it does?
> 
No, this describes a fairly poorly implemented dependency based init
system.  Upstart is event based, and is thus the exact opposite.

Upstart parses all *.conf files under /etc/init and creates in-memory
objects for each of them, which have event matches.  Each time an event
occurs, Upstart marks any event matches as TRUE for them.  If a job's
event tree is TRUE, then it gets started.


A good way of describing the difference is:

 a dependency based system (such as you described) thinks
   "can I start foo yet?  no, it needs bah"

 an event based system (like Upstart) thinks
   "bah just started, what else can I start now?"

Scott
-- 
Scott James Remnant
scott at ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20100305/3120d3ce/attachment.sig>


More information about the Ubuntu-devel-discuss mailing list