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:

84432

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-04-16
algol68g - 3.11.1
Ebuild name:

dev-lang/algol68g-3.11.1

Description

Algol 68 Genie compiler-interpreter

Added to portage

2026-04-16

ansible-molecule - 26.3.0
Ebuild name:

app-admin/ansible-molecule-26.3.0

Description

A toolkit designed to aid in the development and testing of Ansib

Added to portage

2026-04-16

cadical - 3.0.0
Ebuild name:

sci-mathematics/cadical-3.0.0

Description

Simplified Satisfiability Solver

Added to portage

2026-04-16

closure-compiler-bin - 20260412
Ebuild name:

dev-lang/closure-compiler-bin-20260412

Description

JavaScript optimizing compiler

Added to portage

2026-04-16

coreutils - 9.10_p20260415
Ebuild name:

sys-apps/coreutils-9.10_p20260415

Description

Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, wh

Added to portage

2026-04-16

csharp-language-server - 0.23.0
Ebuild name:

dev-dotnet/csharp-language-server-0.23.0

Description

Roslyn-based LSP language server for C

Added to portage

2026-04-16

devcontainer - 0.86.0
Ebuild name:

app-containers/devcontainer-0.86.0

Description

Reference implementation of the Development Containers specifica

Added to portage

2026-04-16

evolution - 3.60.1
Ebuild name:

mail-client/evolution-3.60.1

Description

Integrated mail, addressbook and calendaring functionality

Added to portage

2026-04-16

evolution-data-server - 3.60.1
Ebuild name:

gnome-extra/evolution-data-server-3.60.1

Description

Evolution groupware backend

Added to portage

2026-04-16

evolution-ews - 3.60.1
Ebuild name:

gnome-extra/evolution-ews-3.60.1

Description

Evolution module for connecting to Microsoft Exchange Web Services

Added to portage

2026-04-16

folks - 0.15.12
Ebuild name:

dev-libs/folks-0.15.12

Description

Library for aggregating people from multiple sources

Added to portage

2026-04-16

folks - 0.15.9-r3
Ebuild name:

dev-libs/folks-0.15.9-r3

Description

Library for aggregating people from multiple sources

Added to portage

2026-04-16

folks - 0.15.9-r4
Ebuild name:

dev-libs/folks-0.15.9-r4

Description

Library for aggregating people from multiple sources

Added to portage

2026-04-16

iverilog - 12.0-r1
Ebuild name:

sci-electronics/iverilog-12.0-r1

Description

A Verilog simulation and synthesis tool

Added to portage

2026-04-16

iverilog - 13.0
Ebuild name:

sci-electronics/iverilog-13.0

Description

A Verilog simulation and synthesis tool

Added to portage

2026-04-16

joplin-desktop - 3.6.8
Ebuild name:

app-office/joplin-desktop-3.6.8

Description

Secure note taking and to-do app with synchronization capabilities

Added to portage

2026-04-16

kissat - 4.0.4
Ebuild name:

sci-mathematics/kissat-4.0.4

Description

Keep-it-simple and clean bare metal SAT solver written in C

Added to portage

2026-04-16

libgcrypt - 1.12.2
Ebuild name:

dev-libs/libgcrypt-1.12.2

Description

General purpose crypto library based on the code used in GnuPG

Added to portage

2026-04-16

nvc - 1.20.0
Ebuild name:

sci-electronics/nvc-1.20.0

Description

NVC is a VHDL compiler and simulator

Added to portage

2026-04-16

polychromatic - 0.9.7
Ebuild name:

sys-apps/polychromatic-0.9.7

Description

RGB lighting management software for GNU/Linux powered by OpenRazer

Added to portage

2026-04-16

valgrind - 3.27.0_rc1
Ebuild name:

dev-debug/valgrind-3.27.0_rc1

Description

An open-source memory debugger for GNU/Linux

Added to portage

2026-04-16

vampire - 5.0.1
Ebuild name:

sci-mathematics/vampire-5.0.1

Description

The Vampire Prover, theorem prover for first-order logic

Added to portage

2026-04-16

2026-04-15
atuin - 18.14.1
Ebuild name:

app-shells/atuin-18.14.1

Description

Shell history manager supporting encrypted synchronisation

Added to portage

2026-04-15

b4 - 0.15.2
Ebuild name:

net-mail/b4-0.15.2

Description

Utility for fetching patchsets from public-inbox

Added to portage

2026-04-15

bpftop - 0.8.0
Ebuild name:

dev-util/bpftop-0.8.0

Description

Dynamic real-time view of running eBPF programs

Added to portage

2026-04-15

brltty - 6.9.1
Ebuild name:

app-accessibility/brltty-6.9.1

Description

Daemon that provides access to the Linux/Unix console for a blind pe

Added to portage

2026-04-15

cargo-nextest - 0.9.133
Ebuild name:

dev-util/cargo-nextest-0.9.133

Description

Next-generation test runner for Rust

Added to portage

2026-04-15

cinnamon-settings-daemon - 6.6.3-r1
Ebuild name:

gnome-extra/cinnamon-settings-daemon-6.6.3-r1

Description

Cinnamon's settings daemon

Added to portage

2026-04-15

editables - 0.6
Ebuild name:

dev-python/editables-0.6

Description

A Python library for creating 'editable wheels'

Added to portage

2026-04-15

epiphany - 49.7
Ebuild name:

www-client/epiphany-49.7

Description

GNOME webbrowser based on Webkit

Added to portage

2026-04-15

filelock - 3.28.0
Ebuild name:

dev-python/filelock-3.28.0

Description

A platform independent file lock for Python

Added to portage

2026-04-15

hypothesis - 6.152.1
Ebuild name:

dev-python/hypothesis-6.152.1

Description

A library for property based testing

Added to portage

2026-04-15

leancrypto - 1.7.2-r3
Ebuild name:

dev-libs/leancrypto-1.7.2-r3

Description

Lean cryptographic library usable for bare-metal environments

Added to portage

2026-04-15

libbluray - 1.4.1
Ebuild name:

media-libs/libbluray-1.4.1

Description

Blu-ray playback libraries

Added to portage

2026-04-15

libexif - 0.6.26
Ebuild name:

media-libs/libexif-0.6.26

Description

Library for parsing, editing, and saving EXIF data

Added to portage

2026-04-15

liblouis - 3.37.0
Ebuild name:

dev-libs/liblouis-3.37.0

Description

An open-source braille translator and back-translator

Added to portage

2026-04-15

libraw - 0.22.1-r1
Ebuild name:

media-libs/libraw-0.22.1-r1

Description

LibRaw is a library for reading RAW files obtained from digital photo c

Added to portage

2026-04-15

makeheaders - 0_p20251008
Ebuild name:

dev-util/makeheaders-0_p20251008

Description

Tool that automatically generates .h files for a C or C++ programm

Added to portage

2026-04-15

mako - 1.3.11
Ebuild name:

dev-python/mako-1.3.11

Description

A Python templating language

Added to portage

2026-04-15

mediafile - 0.16.1
Ebuild name:

dev-python/mediafile-0.16.1

Description

Read and write audio files' tags in Python

Added to portage

2026-04-15

mesa - 26.0.5
Ebuild name:

media-libs/mesa-26.0.5

Description

OpenGL-like graphic library for Linux

Added to portage

2026-04-15

mesa_clc - 26.0.5
Ebuild name:

dev-util/mesa_clc-26.0.5

Description

mesa_clc tool used for building OpenCL C to SPIR-V

Added to portage

2026-04-15

microsoft-identity-broker - 3.0.1
Ebuild name:

sys-auth/microsoft-identity-broker-3.0.1

Description

Microsoft Authentication Broker to access a corporate envi

Added to portage

2026-04-15

openjpeg - 2.5.4-r1
Ebuild name:

media-libs/openjpeg-2.5.4-r1

Description

Open-source JPEG 2000 library

Added to portage

2026-04-15

openpgp-keys-keepass - 20260415
Ebuild name:

sec-keys/openpgp-keys-keepass-20260415

Description

OpenPGP key used by KeePass

Added to portage

2026-04-15

openpgp-keys-marcusmeissner - 20260415
Ebuild name:

sec-keys/openpgp-keys-marcusmeissner-20260415

Description

OpenPGP key used by Marcus Meissner

Added to portage

2026-04-15

openpgp-keys-openssl - 20260415
Ebuild name:

sec-keys/openpgp-keys-openssl-20260415

Description

OpenPGP keys used by OpenSSL

Added to portage

2026-04-15

openssl - 4.0.0
Ebuild name:

dev-libs/openssl-4.0.0

Description

Robust, full-featured Open Source Toolkit for the Transport Layer Security (

Added to portage

2026-04-15

osc-lib - 4.5.0
Ebuild name:

dev-python/osc-lib-4.5.0

Description

A package of common support modules for writing OSC plugins

Added to portage

2026-04-15

packaging - 26.1
Ebuild name:

dev-python/packaging-26.1

Description

Core utilities for Python packages

Added to portage

2026-04-15

passlib - 1.9.3
Ebuild name:

dev-python/passlib-1.9.3

Description

Fork of passlib, a password hashing framework

Added to portage

2026-04-15

perf - 6.19.12
Ebuild name:

dev-util/perf-6.19.12

Description

Userland tools for Linux Performance Counters

Added to portage

2026-04-15

perf - 7.0
Ebuild name:

dev-util/perf-7.0

Description

Userland tools for Linux Performance Counters

Added to portage

2026-04-15

prek - 0.3.9
Ebuild name:

dev-util/prek-0.3.9

Description

Better `pre-commit`, re-engineered in Rust

Added to portage

2026-04-15

pygithub - 2.9.1
Ebuild name:

dev-python/pygithub-2.9.1

Description

Python library to access the Github API v3

Added to portage

2026-04-15

pypdf - 6.10.1
Ebuild name:

dev-python/pypdf-6.10.1

Description

Python library to work with PDF files

Added to portage

2026-04-15

pytest-mpl - 0.19.0
Ebuild name:

dev-python/pytest-mpl-0.19.0

Description

Facilitate image comparison for Matplotlib figures

Added to portage

2026-04-15

qtshadertools - 6.11.0-r1
Ebuild name:

dev-qt/qtshadertools-6.11.0-r1

Description

Qt APIs and Tools for Graphics Pipelines

Added to portage

2026-04-15

rust - 1.94.1
Ebuild name:

dev-lang/rust-1.94.1

Description

Systems programming language originally developed by Mozilla

Added to portage

2026-04-15

rust - 1.95.0_beta20260404
Ebuild name:

dev-lang/rust-1.95.0_beta20260404

Description

Systems programming language originally developed by Mozilla

Added to portage

2026-04-15

rust-bin - 1.94.1
Ebuild name:

dev-lang/rust-bin-1.94.1

Description

Added to portage

2026-04-15

rust-bin - 1.95.0_beta20260404
Ebuild name:

dev-lang/rust-bin-1.95.0_beta20260404

Description

Added to portage

2026-04-15

rust-common - 1.94.1
Ebuild name:

dev-lang/rust-common-1.94.1

Description

Common files shared between multiple slots of Rust

Added to portage

2026-04-15

rust-common - 1.95.0_beta20260404
Ebuild name:

dev-lang/rust-common-1.95.0_beta20260404

Description

Common files shared between multiple slots of Rust

Added to portage

2026-04-15

rust-std - 1.94.1
Ebuild name:

sys-devel/rust-std-1.94.1

Description

Rust standard library, standalone (for crossdev)

Added to portage

2026-04-15

rust-std - 1.95.0_beta20260404
Ebuild name:

sys-devel/rust-std-1.95.0_beta20260404

Description

Rust standard library, standalone (for crossdev)

Added to portage

2026-04-15

scamp - 2.15.0
Ebuild name:

sci-astronomy/scamp-2.15.0

Description

Astrometric and photometric solutions for astronomical images

Added to portage

2026-04-15

seer - 2.7
Ebuild name:

dev-util/seer-2.7

Description

GUI frontend to gdb

Added to portage

2026-04-15

sonic - 0.2.0_p20260314
Ebuild name:

media-libs/sonic-0.2.0_p20260314

Description

Simple library to speed up or slow down speech

Added to portage

2026-04-15

tox - 4.53.0
Ebuild name:

dev-python/tox-4.53.0

Description

virtualenv-based automation of test activities

Added to portage

2026-04-15

translate-toolkit - 3.19.5
Ebuild name:

dev-python/translate-toolkit-3.19.5

Description

Toolkit to convert between many translation formats

Added to portage

2026-04-15

umockdev - 0.19.7
Ebuild name:

dev-util/umockdev-0.19.7

Description

Mock hardware devices for creating unit tests

Added to portage

2026-04-15

virtualenv - 21.2.4
Ebuild name:

dev-python/virtualenv-21.2.4

Description

Virtual Python Environment builder

Added to portage

2026-04-15

wrapt - 2.2.0_rc6
Ebuild name:

dev-python/wrapt-2.2.0_rc6

Description

Module for decorators, wrappers and monkey patching

Added to portage

2026-04-15

wtfis - 0.15.0
Ebuild name:

net-analyzer/wtfis-0.15.0

Description

Passive hostname, domain and IP lookup tool for non-robots

Added to portage

2026-04-15

xorg-server - 21.1.22
Ebuild name:

x11-base/xorg-server-21.1.22

Description

X.Org X servers

Added to portage

2026-04-15

xterm - 409
Ebuild name:

x11-terms/xterm-409

Description

Terminal Emulator for X Windows

Added to portage

2026-04-15

xwayland - 24.1.10
Ebuild name:

x11-base/xwayland-24.1.10

Description

Standalone X server running under Wayland

Added to portage

2026-04-15

yara-x - 1.15.0
Ebuild name:

app-forensics/yara-x-1.15.0

Description

A malware identification and classification tool

Added to portage

2026-04-15

zig-bin - 0.16.0
Ebuild name:

dev-lang/zig-bin-0.16.0

Description

A robust, optimal, and maintainable programming language

Added to portage

2026-04-15

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