Application start up times can be annoying if they are really really slow. Part of this latency is a process where before the executable can run, the OS needs to work out which libraries it needs to kick into action.
This process of working out the right libraries can take maybe even several seconds on slower machines and complex apps and can be a big source of slowdowns on application starts.
That's where prelink comes in. What prelink does is it pre-calculates which libraries are needed for certain applications and caches this information so that it can be retrieved quickly.
Quick disclaimer - prelinking is quite a powerful tool and thus if you do it wrong you could end up not being able to start important programs. If you're going to set up prelinking, let the process run the whole way through. Setting it up also needs a little bit of Linux know-how. You have been warned.
A Gentoo howto explains the process well:
“Most common applications make use of shared libraries. These shared libraries need to be loaded into memory at runtime and the various symbol references need to be resolved. For most small programs this dynamic linking is very quick. But for programs written in C++ and that have many library dependencies, the dynamic linking can take a fair amount of time.“On most systems, libraries are not changed very often and when a program is run, the operations taken to link the program are the same every time. Prelink takes advantage of this by carrying out the linking and storing it in the executable, in effect prelinking it.
“Prelinking can cut the startup times of applications. For example, a typical KDE program’s loading time can be cut by as much as 50%. The only maintenance required is re-running prelink every time a library is upgraded for a pre-linked executable.”
On Fedora Core 6, prelink is actually built right in and is set up to work out of the box, so you should already get the speed advantages on application booting. However, you can force the system to re-prelink all the applications on your system using the instructions below.
For other distributions, you can set up prelinking by following these steps:
- Use your package manager to install the prelink package if it isn't already.
- Edit the file /etc/default/prelink so it contains the line - PRELINKING=yes
- As root, run the daily script manually - /etc/cron.daily/prelink
After that, prelinking should automatically run every day and hopefully you'll notice a bit of speed up.
For some more advanced instructions on using prelinking, go to this page and scroll down to the prelinking section. You can also find distro-specific hints and tips by searching for distro name prelink in your favourite search engine.