Ubuntu Upstart START Process analysis

Source: Internet
Author: User

Brief introduction

Recently do Linux course design (kernel cropping and file system customization), selected ubuntu10.10 as the platform for the experiment. Different Linux distributions, the user state initialization mechanism is different, Ubuntu since the 6.10 version of the use of newer upstart mechanism for system initialization.

Upstart is an event-driven service startup mechanism that enables multiple system tasks to be started concurrently with dependencies (which is said to start faster, in theory). When using the upstart mechanism, we specify the dependencies (startup time) of various system services through a series of *.conf configuration files under/etc/init. When the system is started, the upstart main process/sbin/init resolves the configuration files and starts various services and applications concurrently with the specified dependencies.

Main program

The upstart has three main processes:

The Init:upstart master process, which is the "Application Manager" in the Linux system, is the source of all other processes (PID 1), reads the configuration file, handles the dependencies of various services and applications, initiates these functions and services based on events (signals), and manages them dynamically.
The Initctl:upstart event Manager, which can be used by application processes to inform INIT which events (signals) occur.
Telinit: Manage Run level (run level, retained for compatibility with other old distributions, in upstart, the change of run level is treated as some kind of event).

Configuration file

The conf configuration file for each service usually indicates the execution of dependent events (signals), the execution environment, the task attributes performed, the task contents performed, and so on.

As the typical script below indicates that the task performed is to start a terminal named Tty2, dependent on the Startup event, the console owner indicates that the output is directed to the console at execution time, and the Respawn property specifies that if the process finalization will restart.

1 2 3 4 5 6 7 Start on startup respawn console owner Exec/sbin/getty-8 38400 tty2

Start process

For the Ubuntu release, after starting/sbin/init, upstart will go through the following boot process:

1. After the internal initialization of the upstart, start Startup event, the Ubuntu system began to initialize;

2. The task that relies on the startup event starts, the most important of which is mountall, which mounts the hard disk and file system, triggering a series of events in turn, including: Local-filesystems, Vitual-filesystems, All-swaps, etc.;

3. The Vitual-filesystems event triggers a Udev-related series of tasks for device event management. which Upstart-udev-bridge converts device events into upstart events, and Udevtrigger triggers device events for devices that have been mounted (because many device events have been missed when UDEVD started).

4. Udevtrigger triggers the local loopback network interface startup (net-device-up) event, which is available at this stage of the local loop (127.0.0.1);

5. Wait until the file system mount completes, the local Loop network interface starts, the Rc-sysinit which relies on these two events officially launches in the limelight, invokes Telinit sets the system the running level, the system enters the RunLevel management New era ...

The process from startup to RunLevel is shown in the following figure:

Upstart Start flowchart

Rc-sysinit, use Telinit to set the running level for the system, triggering the RunLevel event, which relies on the service startup of the RunLevel event, which has very important TTY, while some of the services are off, the system shuts down, The reboot and other actions also depend on the runlevel changes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.