from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

82691

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Misc

Speeding up the boot process (next generation)

The idea is to preload the useful files into kernel buffer cache before they are needed. Since I/O can happen parallel to the other CPU intensive tasks during bootup, this leads to faster bootup and faster startup time for your chosen applications. Other projects use static lists to preload the files.

This tutorial uses an automated process of generating the "useful" prefetch database.

This is /etc/init.d/my-readahead.
Code:

#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
        before syslog-ng
}

start() {
        ebegin "Starting readahead ROYALE"
        cat /etc/conf.d/* > /dev/null 2>&1 &
        cat /usr/lib/gconv/gconv-modules.cache > /dev/null 2>&1 &
        cat /usr/share/icons/gnome/icon-theme.cache > /dev/null 2>&1 &
        cat /usr/share/icons/hicolor/icon-theme.cache > /dev/null 2>&1 &
        cat `cat /etc/conf.d/sofile-list.load` > /dev/null 2>&1 &
        if [ -f /forcesampler ];then
                /usr/sbin/sample-init-process /etc/conf.d/sofile-list.load &
                rm -f /forcesampler
        fi 
        eend 0
}

stop() {
        eend 0
}

The executable shell script /usr/sbin/sample-init-process:
Code:

 #!/bin/bash
final_db="$1"

# total number of lists to keep in /etc/conf.d/
total_to_keep=4

# total number of samples to make in /forcesampler boot.
# It will take twice this amount of seconds to finish sampling.
total_samples_per_boot=200

# touch empty file if not there
[ ! -f "$final_db" ] && touch "$final_db"

let i=0
while [ "$i" -ne "$total_to_keep" ] ; do
        if [ ! -f "$final_db$i" ] ; then
                break;
        else
                j=$((i+1))
                if [ "$j" = "$total_to_keep" ] ;then
                        j=0
                fi
                if [ -f "$final_db$j" -a "$final_db$i" -nt "$final_db$j" ];then
                        i=$((j))
                        break;
                fi
        fi
        i=$((i+1))
done
if [ "$i" = "$total_to_keep" ] ;then
        i=0
fi

slot="$i"
cp "$final_db" "$final_db$i"

function collect_sample()
{
        lsof | awk '{if ($5=="REG") {if (match($9,".so") || match($9,".conf") \
        || match($9,"/bin/") || match($9,"ttf") || match($9,"libexec")) \
        print $9}}' | sort | uniq >> $1
}

collect_sample /tmp/init_sample1

i=0 
while [ "$i" -ne "$total_samples_per_boot" ] ; do
        collect_sample /tmp/init_sample2
        cat /tmp/init_sample1 /tmp/init_sample2 | sort | uniq > /tmp/init_sample3
        mv /tmp/init_sample3 /tmp/init_sample1
        sleep 1
        i=$((i+1))
done

cat /tmp/init_sample1 "$final_db$slot" | sort | uniq > "$final_db"

rm -f /tmp/init_sample[123]
And then do this:
Code:
chmod +x /usr/sbin/sample-init-process
rc-update add my-readahead default
touch /forcesampler

What you have done is asked my-readahead to create a sampler process which samples what files (fonts, binaries, libraries, configs) are in use, every second. It collects 200 samples (will be busy for at least 10 minutes after boot) and keeps updating the database with a list of useful files.

Once you boot after this the first time, you will probably see a slow down because its collecting samples for use on the next and subsequent boots. Use your system as you normally would. Open firefox, gaim, OO or whatever. Once the sampler script has finished ('ps -aef|grep sample-init-process' will tell you if its running), reboot. Now this and all subsequent boots will be much faster.

If it takes too long for the sample-init-process to finish, reduce the total_samples_per_boot variable in the sampler script to 100 and try again by touching /forcesampler.

In future, whenever you feel like updating the prefetch database, just 'touch /forcesampler' and database will be updated on next reboot.

based on http://forums.gentoo.org/viewtopic-t-478491.html, some script modifications done.

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2026-01-02
eisl - 5.62
Ebuild name:

dev-lang/eisl-5.62

Description

Interpreter and compiler compatible with the ISLisp standard

Added to portage

2026-01-02

nprolog - 4.78
Ebuild name:

dev-lang/nprolog-4.78

Description

Interpreter and compiler to be compatible with Arity/Prolog32

Added to portage

2026-01-02

2026-01-01
amq-protocol - 2.5.0
Ebuild name:

dev-ruby/amq-protocol-2.5.0

Description

An AMQP 0.9.1 serialization library for Ruby

Added to portage

2026-01-01

arti - 1.8.0
Ebuild name:

net-p2p/arti-1.8.0

Description

Implementation of Tor in Rust

Added to portage

2026-01-01

bcrypt-ruby - 3.1.21
Ebuild name:

dev-ruby/bcrypt-ruby-3.1.21

Description

An easy way to keep your users' passwords secure

Added to portage

2026-01-01

cddlib - 094n
Ebuild name:

sci-libs/cddlib-094n

Description

C library implementing the Double Description Method

Added to portage

2026-01-01

chrome-binary-plugins - 143.0.7499.169
Ebuild name:

www-plugins/chrome-binary-plugins-143.0.7499.169

Description

Binary plugins from Google Chrome for use in Chrom

Added to portage

2026-01-01

chrome-binary-plugins - 144.0.7559.31_beta
Ebuild name:

www-plugins/chrome-binary-plugins-144.0.7559.31_beta

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-01-01

chrome-binary-plugins - 145.0.7587.4_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-145.0.7587.4_alpha

Description

Binary plugins from Google Chrome for use in C

Added to portage

2026-01-01

chromedriver-bin - 143.0.7499.169
Ebuild name:

www-apps/chromedriver-bin-143.0.7499.169

Description

WebDriver for Chrome

Added to portage

2026-01-01

curl - 8.18.0_rc3
Ebuild name:

net-misc/curl-8.18.0_rc3

Description

A Client that groks URLs

Added to portage

2026-01-01

deskflow - 1.25.0
Ebuild name:

gui-apps/deskflow-1.25.0

Description

Share a mouse and keyboard between computers (FOSS version of Synergy)

Added to portage

2026-01-01

fable - 4.28.0
Ebuild name:

dev-dotnet/fable-4.28.0

Description

F to JavaScript, TypeScript, Python, Rust and Dart Compiler

Added to portage

2026-01-01

fonttosfnt - 1.2.5
Ebuild name:

x11-apps/fonttosfnt-1.2.5

Description

X.Org fonttosfnt application

Added to portage

2026-01-01

git-merge-changelog - 1.0
Ebuild name:

dev-vcs/git-merge-changelog-1.0

Description

Git merge driver for GNU style ChangeLog files

Added to portage

2026-01-01

gnatformat - 26.0.0
Ebuild name:

dev-ada/gnatformat-26.0.0

Description

Opinionated code formatter for the Ada language

Added to portage

2026-01-01

google-chrome - 143.0.7499.169
Ebuild name:

www-client/google-chrome-143.0.7499.169

Description

The web browser from Google

Added to portage

2026-01-01

google-chrome-beta - 144.0.7559.31
Ebuild name:

www-client/google-chrome-beta-144.0.7559.31

Description

The web browser from Google

Added to portage

2026-01-01

google-chrome-unstable - 145.0.7587.4
Ebuild name:

www-client/google-chrome-unstable-145.0.7587.4

Description

The web browser from Google

Added to portage

2026-01-01

libsdl2 - 2.32.62
Ebuild name:

media-libs/libsdl2-2.32.62

Description

Simple Direct Media Layer

Added to portage

2026-01-01

libsdl3 - 3.2.30
Ebuild name:

media-libs/libsdl3-3.2.30

Description

Simple Direct Media Layer

Added to portage

2026-01-01

libsdl3 - 3.4.0
Ebuild name:

media-libs/libsdl3-3.4.0

Description

Simple Direct Media Layer

Added to portage

2026-01-01

libva-intel-media-driver - 25.4.6
Ebuild name:

media-libs/libva-intel-media-driver-25.4.6

Description

Intel Media Driver for VA-API (iHD)

Added to portage

2026-01-01

lidarr-bin - 3.1.1.4900
Ebuild name:

www-apps/lidarr-bin-3.1.1.4900

Description

Looks and smells like Sonarr but made for music

Added to portage

2026-01-01

melonds - 1.1-r1
Ebuild name:

games-emulation/melonds-1.1-r1

Description

Nintendo DS emulator, sorta

Added to portage

2026-01-01

microsoft-edge - 143.0.3650.96
Ebuild name:

www-client/microsoft-edge-143.0.3650.96

Description

The web browser from Microsoft

Added to portage

2026-01-01

microsoft-edge-beta - 144.0.3719.23
Ebuild name:

www-client/microsoft-edge-beta-144.0.3719.23

Description

The web browser from Microsoft

Added to portage

2026-01-01

microsoft-edge-beta - 144.0.3719.35
Ebuild name:

www-client/microsoft-edge-beta-144.0.3719.35

Description

The web browser from Microsoft

Added to portage

2026-01-01

microsoft-edge-dev - 145.0.3734.1
Ebuild name:

www-client/microsoft-edge-dev-145.0.3734.1

Description

The web browser from Microsoft

Added to portage

2026-01-01

moonlight - 6.1.0-r3
Ebuild name:

net-misc/moonlight-6.1.0-r3

Description

NVIDIA GameStream (and Sunshine) client

Added to portage

2026-01-01

obs-vkcapture - 1.5.3-r1
Ebuild name:

media-plugins/obs-vkcapture-1.5.3-r1

Description

OBS Linux Vulkan/OpenGL game capture

Added to portage

2026-01-01

opera - 125.0.5729.49
Ebuild name:

www-client/opera-125.0.5729.49

Description

A fast and secure web browser

Added to portage

2026-01-01

opera-beta - 126.0.5750.11
Ebuild name:

www-client/opera-beta-126.0.5750.11

Description

A fast and secure web browser

Added to portage

2026-01-01

opera-developer - 126.0.5748.0
Ebuild name:

www-client/opera-developer-126.0.5748.0

Description

A fast and secure web browser

Added to portage

2026-01-01

outline-magic - 0.9
Ebuild name:

app-emacs/outline-magic-0.9

Description

Outline mode extensions for Emacs

Added to portage

2026-01-01

package-build - 4.0.0
Ebuild name:

app-emacs/package-build-4.0.0

Description

Tools for assembling a package archive

Added to portage

2026-01-01

pauker - 1.8-r5
Ebuild name:

games-puzzle/pauker-1.8-r5

Description

A java based flashcard program

Added to portage

2026-01-01

pymdown-extensions - 10.20
Ebuild name:

dev-python/pymdown-extensions-10.20

Description

Extensions for Python Markdown

Added to portage

2026-01-01

python-gnupg - 0.5.6
Ebuild name:

dev-python/python-gnupg-0.5.6

Description

A Python wrapper for GnuPG

Added to portage

2026-01-01

radarr-bin - 6.1.0.10316
Ebuild name:

www-apps/radarr-bin-6.1.0.10316

Description

A fork of Sonarr to work with movies a la Couchpotato

Added to portage

2026-01-01

rgb - 1.1.1
Ebuild name:

x11-apps/rgb-1.1.1

Description

uncompile an rgb color-name database

Added to portage

2026-01-01

rouge - 4.7.0
Ebuild name:

dev-ruby/rouge-4.7.0

Description

Yet-another-markdown-parser using a strict syntax definition in pure Ruby

Added to portage

2026-01-01

socket-burst-dampener - 1.3.4
Ebuild name:

net-misc/socket-burst-dampener-1.3.4

Description

A daemon that spawns one command per connection, and dampens c

Added to portage

2026-01-01

sourcegit - 2025.41
Ebuild name:

dev-vcs/sourcegit-2025.41

Description

Open Source Git GUI client using .NET AvaloniaUI

Added to portage

2026-01-01

sphinx - 9.1.0
Ebuild name:

dev-python/sphinx-9.1.0

Description

Python documentation generator

Added to portage

2026-01-01

tlfloat - 1.17.1_p20250711
Ebuild name:

dev-cpp/tlfloat-1.17.1_p20250711

Description

C++ template library for floating point operations

Added to portage

2026-01-01

tt-rss - 20251216
Ebuild name:

www-apps/tt-rss-20251216

Description

Tiny Tiny RSS - A web-based news feed (RSS/Atom) aggregator using AJAX

Added to portage

2026-01-01

ty - 0.0.7
Ebuild name:

dev-util/ty-0.0.7

Description

An extremely fast Python type checker and language server, written in Rust

Added to portage

2026-01-01

xauth - 1.1.5
Ebuild name:

x11-apps/xauth-1.1.5

Description

X authority file utility

Added to portage

2026-01-01

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 67.7 ms