Focus on Pinit
One of Cooker's newest additions is 'pinit', the parallel initialization system developed by community contributor Couriousous. Parallel initialization involves starting services during boot in parallel instead of in strict sequence, as was previously the case. This provides an improvement in startup speeds, but is hard to implement in a simple way while making sure initialization still works and maintaining compatibility with existing standards. Unlike previous implementations, pinit maintains compliance with SysV? (the traditional sequential initialization system) and is also compliant with the LSB (Linux Standards Base) specifications for phrasing the dependencies between services. pinit consists of a small executable named 'prcsys', which has been added to the initscripts package. When the 'pinit' kernel parameter is specified, prcsys controls the initialization process and uses the LSB service dependency comments in the initscripts of each service to determine which services can be started in parallel. Services which have not yet been updated to include this information are initialized in the same place during the sequence as they would have been under the old system, to maintain SysV? compliance. Since the new system requires only additional comments in the initscript, if it is disabled, initialization proceeds as normal under the old system.
Deeper into Pinit!
Under Mandriva Linux the boot system is based on a System V like initialisation. The boot is handled by a set of scripts, usually called 'initscripts'. The main boot scripts are located into the directory /etc/rc.d/, rc.sysinit, being the first script launched by the init process at the boot of the machine. This script is performing quite a lot of actions, it initialises the fonts, mounts the root partition, runs udev, checks the filesystems and then mounts them, and, if needed, configures the RAID or LVM devices. Then init runs the script rc, which is more or less a scheduler which launches all the other initialisation scripts which are located into the directory /etc/init.d.
To be more precise, the directories /etc/rc.d/rcX.d where X is the desired runlevel (0 to 6), hold symbolic links to the scripts which are in the directory /etc/init.d to select, depending of the runlevel, what should be run and what should be stopped (with a command like service service_name start/stop). With the current system, each symbolic link in, say, /etc/rc.d/rc3.d/, includes a letter, S for start and K for kill, followed by a number between 00 and 99, and, at the end, the name of the initscript. With this structure, the links included into the directory /etc/rc.d/rc3.d/ are sorted in order, first the KXXinitscript_name, then SXXinitscript_name, for example :
* K09dm
* K10psacct
* S03iptables
* S04acpi
* S04dkms
* S05harddrake
* S10network
* K10psacct
* S03iptables
* S04acpi
* S04dkms
* S05harddrake
* S10network
In this example, the scripts dm, psacct will be successively stopped, then the services iptables, acpi, dkms, harddrake and network will be launched. Up to now the launching of the scripts was sequential, rc waiting for the dkms script to finish before launching the script harddrake. However, most of the time, a lot of things could be done in parallel, and allow to gain some precious seconds during the boot sequence.
A Mandriva contributor, Philippe Rétornaz, more known as Couriousous, has developed a program, Pinit, which allows, if an extra dependencies information is included into the initscripts headers, to calculate a scripts layout to be able to launch simultaneously all the scripts which are not relying on other scripts to run, and to run the other ones as soon as the scripts they are relying on are finished. The improvement in the boot time is very dependent of your configuration, but usually noticeable, several seconds, even up to 20 or 30 percent. To compare precisely the variation in the boot time, you can use the program called bootchart. This program is available in the package named bootchart, in contrib. It is simply launched when you boot, giving init=bootchartd as kernel parameter, then a java program is able to use the data logged in /var/log/bootchart.tgz to create a boot chart of the full boot process. For more information, you can consult the online help on: http://www.bootchart.org or on: http://qa.mandriva.com/twiki/bin/view/Main/BootTimeOptimisation.
The Mandriva Community Wiki is also holding a section dedicated to the parallel boot: http://qa.mandriva.com/twiki/bin/view/Main/Pinit