prelink

{{multiple issues|

{{primary sources|date=March 2011}}

{{one source|date=April 2010}}

{{more citations needed|date=March 2010}}

}}

{{lowercase title|prelink}}

In computing, prebinding, also called prelinking, is a method for optimizing application load times by resolving library symbols prior to launch.

Background

Most computer programs consist of code that requires external shared libraries to execute. These libraries are normally integrated with the program at run time by a loader, in a process called dynamic linking.

While dynamic linking has advantages in code size and management, there are drawbacks as well. Every time a program is run, the loader needs to resolve (find) the relevant libraries. Since libraries move around in memory, there is a performance penalty for resolution. This penalty increases for each additional library needing resolution.

Prelinking reduces this penalty by resolving libraries in advance. Afterward, resolution only occurs if the libraries have changed since being prelinked, such as following perhaps an upgrade.

Mac OS

Mac OS stores executables in the Mach-O file format.

=Mac OS X=

Mac OS X performs prebinding in the "Optimizing" stage of installing system software or certain applications.

Prebinding has changed a few times within the Mac OS X series. Before 10.2, prebinding only happened during the installation procedure (the aforementioned "Optimizing" stage). From 10.2 through 10.3 the OS checked for prebinding at launch time for applications, and the first time an application ran it would be prebound, making subsequent launches faster. This could also be manually run, which some OS-level installs did. In 10.4, only OS libraries were prebound. In 10.5 and later, Apple replaced prebinding with a dyld shared cache mechanism,{{cite web | url=https://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/10.5/man1/update_prebinding.1.html | title=Manual Page for update_prebinding | publisher=Apple Computer Inc | work=Apple Developer Connection }} which provided better OS performance.

Linux

On Linux, prelinking is accomplished via the prelink program, a free program written by Jakub Jelínek of Red Hat for ELF binaries.

Performance results have been mixed{{clarify|date=November 2016}}, but it seems to aid systems with a large number of libraries, such as KDE.

{{cite web

| title = ELF Prelinking and what it can do for you

| first = James| last = Crasta

| date = 2004-05-17

| url = http://crast.us/james/articles/prelink.php

| access-date = 2006-05-10

}}

Issues

Occasionally, prelinking can cause issues with application checkpoint and restart libraries like blcr,[https://ftg.lbl.gov/projects/CheckpointRestart/ blcr] as well as other libraries (like OpenMPI) that use blcr internally. Specifically when checkpointing a program on one host, and trying to restart on a different host, the restarted program may fail with a segfault due to differences in host-specific library memory address randomization.

{{cite web

| title = BLCR FAQ

| access-date = 2012-01-05

| url = https://upc-bugs.lbl.gov/blcr/doc/html/FAQ.html#prelink

}}

{{cite mailing list

|url= http://www.open-mpi.org/community/lists/users/2011/12/18071.php

|title= segfault when resuming on different host

|date= 2011-12-29

|access-date=2012-01-05

|mailing-list= OpenMPI Users

|last= Hursey

|first= Josh

}}{{unreliable source?|date=August 2013}}

See also

References

{{reflist}}

  • [http://radio.weblogs.com/0100490/stories/2002/08/24/prebindingExplained.html A detailed explanation] of prebinding

Further reading

  • {{cite journal

| title = Prelink

| first = Jakub| last = Jelínek

| version = Draft 0.7

| date = 2004-03-04

| url = http://people.redhat.com/jakub/prelink.pdf

| access-date = 2006-07-14

}}