RFC: 'quiesced' event?

Steve Langasek steve.langasek at ubuntu.com
Fri Mar 15 22:11:38 UTC 2013


Hi folks,

One of the questions people often ask about using upstart is, "How do I
write a job to do something once the system is booted?"  And the
counter-question in response is, "How do you define 'booted' in an
event-driven system, where further events can happen at any point?"

I was reflecting on this question today in connection with the following
bug:

  https://bugs.launchpad.net/ubuntu/+source/plymouth/+bug/967229

And I realized that the recent work on user sessions might offer a possible
answer.  In the course of defining user session shutdown behavior, we *did*
define a concept of when upstart is "done": when there are no longer any
jobs that are "blocked" (i.e., they have a start/stop condition with an AND,
where one half of the condition has been met but the other has not), and all
jobs have the same goal and state (stop/waiting or start/running).  We said
that when the user session init reaches such a state, the system has
"quiesced", and init can take further action to forcibly shut down the
remaining jobs and exit.

What if we were to generalize this concept, and make it a core event within
upstart?  That is, whenever upstart reaches this state, emit a 'quiesced'
event?

This would enable jobs with semantics like the following:

  start on runlevel [2345]
  stop on quiesced

  pre-stop exec plymouth quit

Great care would need to be taken in constructing jobs to ensure that this
event remains useful; for instance, anything that did 'start on runlevel
[2345] and quiesced' would fire once, catch the next 'quiesced' event, and
*block any further quiesced events from happening*.  But in theory, this
seems to me like it would be a pretty powerful extension to upstart
semantics.

Thoughts?

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/upstart-devel/attachments/20130315/797ae3b5/attachment.pgp>


More information about the upstart-devel mailing list