From Mageia wiki
Jump to: navigation, search


Parallel Init

Pinit : A parallel init implementation for Mageia done by Couriousous '(originally for Mandriva) comment: let it so?'

Goal

There are three major concerns about a possible parallel init integration in Mageia :

  • LSB init compliance
  • Does not mix up startup script output
  • Doesn't need heavy modification to current startup scripts

Implementation

Features

  • Bootsplash support
  • Maximum 255 steps are supported
  • Supports LSB dependency tag
  • Stop mode : So the machine's shutdown "stop" scripts are started also in parallel respecting the LSB stop dependency informations
  • A "Debug" mode. When you run prcsys with the "--test" argument, it will not start the scripts, but only print the command
  • # X-Mageia-Interactive : Special tag to tell prcsys that the service is interactive. So it must have direct and exclusive access to the console
  • # X-Mageia-Compat-Mode : Special tag to tell prcsys that the service is LSB-ified, but must not be started in parallel, the "Compat mode" will be enabled for this service.
  • Lazy requires which means that prcsys is just ordering the services but is not enforcing dependencies.
  • Logging facility : prcsys will log the runlevel startup in the file /var/log/prcsys.log.

Usage

Every init script can Require and Provide a service. The service name is automatically provided. To be parallel-enabled, it 'MUST' contain the Traditional LSB header

When such a header is found, there is no more SXXservice ordering. Prcsys will only ensure that every dependency is started before starting the service.

Parallel init is enabled by default, it can be disabled by using the **nopinit** parameter on the kernel command line.

# X-Mageia-Interactive

If the service must have direct access to the console use this tag. It will call the service without output redirection. It will have the exclusive console access. Avoid using it, it's only for really special services (e.g.: harddrake).

# X-Mageia-Compat-Mode

If the service must be started in a non parallel mode, but must have the LSB header, add this flags. Prcsys will start the service in compat mode. Warning, dependency loop can happen if other services requires it. Use with caution.

Let's talk about LSB compliance: if a service doesn't contain any LSB header, it will automatically require every service which is before it ( in terms of filename ), and every service after it will require it. So, it will be started in the same order as in a standard init scheme and not in parallel, but all other parallel-enabled services will be started in parallel.

How does it keep a clean output? The output of every service is temporarily stocked in a file and then when the service startup is over, it's printed on the console. The console is accessed by a mutex, so the output is not mixed.

It has a basic requires loop detection and resolution: if service A requires B which requires C which requires A. The boot process will deadlock. To avoid that, it will breake a requires (and complain loudly).

TODO

What are current limitations ( patch also welcome ):

  • Doesn't do exactly what rc script does.
  • isn't bullet proof against user misuse


How to try it

'comment by Daniel Kreuter (Mageia): should we keep that section below?'

It is enabled by default in Mageia Cauldron.

Not all Mageia initscripts are patched to provide dependency information. I will produce more if there is interest to do it. Alternatively you can do it yourself with the above explanations and contribute it back.

To provide a patch for a services init script, please consult the Mandriva CVS. For usage please have a look at CVS Howto.

Performance

(You can see larger copies of these images at http://www.zarb.org/~couriousous/boot/old/bootchart/)

In this example, there is a 12 sec gain in boot. It means a 20% speedup over total boot time and ~25% speedup over runlevel boot time. We can see now that there is no more waiting in the boot process and the limiting factor is the harddisk.

History

A previous prcsys implementation was using X-Parallel-* tag to read dependency informations. This is obsolete and support for those tags will be removed soon from prcsys.

References