Static Linking VS Dynamic Linking Haitao Wang Xiaomin
![Static Linking VS. Dynamic Linking Haitao Wang, Xiaomin Liu December 13, 2006 Static Linking VS. Dynamic Linking Haitao Wang, Xiaomin Liu December 13, 2006](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-1.jpg)
![Static Linking Carried out only once to produce an executable file. If static libraries Static Linking Carried out only once to produce an executable file. If static libraries](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-2.jpg)
![Dynamic Linking Allows a process to add, remove, replace or relocate object modules during Dynamic Linking Allows a process to add, remove, replace or relocate object modules during](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-3.jpg)
![A Big Difference If several processes call the same object module of a shared A Big Difference If several processes call the same object module of a shared](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-4.jpg)
![Which one is better, static or dynamic? Construct some programs of different size linked Which one is better, static or dynamic? Construct some programs of different size linked](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-5.jpg)
![Executable size (Byte) Static Small Dynami c (Loadin g) 422596 5152 Dynami c (Runnin Executable size (Byte) Static Small Dynami c (Loadin g) 422596 5152 Dynami c (Runnin](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-6.jpg)
![Loading time (us) Loading time (us)](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-7.jpg)
![Running time (s) Running time (s)](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-8.jpg)
![Number of System Calls Number of System Calls](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-9.jpg)
![Memory Usage (Byte) Memory Usage (Byte)](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-10.jpg)
![Change the Percentage of Static Lib Produce several different versions of executables by changing Change the Percentage of Static Lib Produce several different versions of executables by changing](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-11.jpg)
![Executable Sizes Executable Sizes](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-12.jpg)
![Loading Time Loading Time](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-13.jpg)
![Running Time Running Time](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-14.jpg)
![Static linking VS. Dynamic linking ¡ Dynamic produces smaller executable files. ¡ Dynamic consumes Static linking VS. Dynamic linking ¡ Dynamic produces smaller executable files. ¡ Dynamic consumes](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-15.jpg)
![Standard Programs ¡ Some programs in Linux system are rebuilt. Both static and dynamic Standard Programs ¡ Some programs in Linux system are rebuilt. Both static and dynamic](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-16.jpg)
![Executable Size (Bytes) PMEM MPG FGET VIM 46043 979931 582796 9935633 Dynamic 17892 494443 Executable Size (Bytes) PMEM MPG FGET VIM 46043 979931 582796 9935633 Dynamic 17892 494443](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-17.jpg)
![Number of System Calls Static PMEM 5 Dynamic 102 MPG 34 FGET 11 VIM Number of System Calls Static PMEM 5 Dynamic 102 MPG 34 FGET 11 VIM](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-18.jpg)
![Vim System Call Sys call Open Close Read Stat 64 Old_mmap Static 88 58 Vim System Call Sys call Open Close Read Stat 64 Old_mmap Static 88 58](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-19.jpg)
![Loading Time Loading Time](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-20.jpg)
![Sharing Across File System ¡ Examine the contents of executables and libraries in a Sharing Across File System ¡ Examine the contents of executables and libraries in a](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-21.jpg)
![¡ There are 1831 dynamically linked programs and only one static linked (/bin/ash. static), ¡ There are 1831 dynamically linked programs and only one static linked (/bin/ash. static),](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-22.jpg)
![Most Frequently Referenced Libs Name libc. so. 6 ld-linux. so. 2 libm. so. 6 Most Frequently Referenced Libs Name libc. so. 6 ld-linux. so. 2 libm. so. 6](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-23.jpg)
![Programs with Most Libs Program Name Ximian-connector-setup-2. 0 Evolution-2. 0 Nautilus Number of Libraries Programs with Most Libs Program Name Ximian-connector-setup-2. 0 Evolution-2. 0 Nautilus Number of Libraries](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-24.jpg)
![Future Work ¡ Build some much larger standard programs in both versions and compare Future Work ¡ Build some much larger standard programs in both versions and compare](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-25.jpg)
- Slides: 25
![Static Linking VS Dynamic Linking Haitao Wang Xiaomin Liu December 13 2006 Static Linking VS. Dynamic Linking Haitao Wang, Xiaomin Liu December 13, 2006](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-1.jpg)
Static Linking VS. Dynamic Linking Haitao Wang, Xiaomin Liu December 13, 2006
![Static Linking Carried out only once to produce an executable file If static libraries Static Linking Carried out only once to produce an executable file. If static libraries](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-2.jpg)
Static Linking Carried out only once to produce an executable file. If static libraries are called, the linker will copy all the modules referenced by the program to the executable.
![Dynamic Linking Allows a process to add remove replace or relocate object modules during Dynamic Linking Allows a process to add, remove, replace or relocate object modules during](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-3.jpg)
Dynamic Linking Allows a process to add, remove, replace or relocate object modules during its execution. If shared libraries are called, 1. Only copy a little reference information when the executable file is created. 2. Completing the linking during loading time or running time.
![A Big Difference If several processes call the same object module of a shared A Big Difference If several processes call the same object module of a shared](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-4.jpg)
A Big Difference If several processes call the same object module of a shared library simultaneously, ¡ Only one copy in memory (dynamic) ¡ Several copies each for a process in memory (static)
![Which one is better static or dynamic Construct some programs of different size linked Which one is better, static or dynamic? Construct some programs of different size linked](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-5.jpg)
Which one is better, static or dynamic? Construct some programs of different size linked in both versions to compare: Executable size Loading time Running time System call Memory usage
![Executable size Byte Static Small Dynami c Loadin g 422596 5152 Dynami c Runnin Executable size (Byte) Static Small Dynami c (Loadin g) 422596 5152 Dynami c (Runnin](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-6.jpg)
Executable size (Byte) Static Small Dynami c (Loadin g) 422596 5152 Dynami c (Runnin g) 6300 Median 431413 5152 6297 Large 443384 5134 6312
![Loading time us Loading time (us)](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-7.jpg)
Loading time (us)
![Running time s Running time (s)](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-8.jpg)
Running time (s)
![Number of System Calls Number of System Calls](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-9.jpg)
Number of System Calls
![Memory Usage Byte Memory Usage (Byte)](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-10.jpg)
Memory Usage (Byte)
![Change the Percentage of Static Lib Produce several different versions of executables by changing Change the Percentage of Static Lib Produce several different versions of executables by changing](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-11.jpg)
Change the Percentage of Static Lib Produce several different versions of executables by changing the percentage of the static libraries among all libraries written by ourselves when programs are linked (those standard libs, such as libc, are always dynamically linked).
![Executable Sizes Executable Sizes](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-12.jpg)
Executable Sizes
![Loading Time Loading Time](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-13.jpg)
Loading Time
![Running Time Running Time](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-14.jpg)
Running Time
![Static linking VS Dynamic linking Dynamic produces smaller executable files Dynamic consumes Static linking VS. Dynamic linking ¡ Dynamic produces smaller executable files. ¡ Dynamic consumes](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-15.jpg)
Static linking VS. Dynamic linking ¡ Dynamic produces smaller executable files. ¡ Dynamic consumes less memory. ¡ Dynamic runs more slowly. ¡ Dynamic has more system calls. ¡ Dynamic need more loading time
![Standard Programs Some programs in Linux system are rebuilt Both static and dynamic Standard Programs ¡ Some programs in Linux system are rebuilt. Both static and dynamic](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-16.jpg)
Standard Programs ¡ Some programs in Linux system are rebuilt. Both static and dynamic versions are created and some benchmarks are compared. ¡ PMEM, MPG 123, FGET, VIM
![Executable Size Bytes PMEM MPG FGET VIM 46043 979931 582796 9935633 Dynamic 17892 494443 Executable Size (Bytes) PMEM MPG FGET VIM 46043 979931 582796 9935633 Dynamic 17892 494443](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-17.jpg)
Executable Size (Bytes) PMEM MPG FGET VIM 46043 979931 582796 9935633 Dynamic 17892 494443 93721 3875807 Static
![Number of System Calls Static PMEM 5 Dynamic 102 MPG 34 FGET 11 VIM Number of System Calls Static PMEM 5 Dynamic 102 MPG 34 FGET 11 VIM](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-18.jpg)
Number of System Calls Static PMEM 5 Dynamic 102 MPG 34 FGET 11 VIM 1626 178 119 2218
![Vim System Call Sys call Open Close Read Stat 64 Oldmmap Static 88 58 Vim System Call Sys call Open Close Read Stat 64 Old_mmap Static 88 58](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-19.jpg)
Vim System Call Sys call Open Close Read Stat 64 Old_mmap Static 88 58 473 11 40 Dynamic 296 102 569 55 110
![Loading Time Loading Time](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-20.jpg)
Loading Time
![Sharing Across File System Examine the contents of executables and libraries in a Sharing Across File System ¡ Examine the contents of executables and libraries in a](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-21.jpg)
Sharing Across File System ¡ Examine the contents of executables and libraries in a standard Linux system. ¡ Programs in /bin and /usr/bin are examined.
![There are 1831 dynamically linked programs and only one static linked binash static ¡ There are 1831 dynamically linked programs and only one static linked (/bin/ash. static),](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-22.jpg)
¡ There are 1831 dynamically linked programs and only one static linked (/bin/ash. static), which also has its dynamic version (/bin/ash) in the system. ¡ Dynamic linking is dominant throughout the system.
![Most Frequently Referenced Libs Name libc so 6 ldlinux so 2 libm so 6 Most Frequently Referenced Libs Name libc. so. 6 ld-linux. so. 2 libm. so. 6](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-23.jpg)
Most Frequently Referenced Libs Name libc. so. 6 ld-linux. so. 2 libm. so. 6 libdl. so. 2 libz. so. 1 libpthread. so. 0 libresolv. so. 2 lib. X 11. so. 6 lib. Xext. so. 6 Directory /lib/tls/libc. so. 6 /lib/ld-linux. so. 2 /lib/tls/libm. so. 6 /libdl. so. 2 /usr/libz. so. 1 /lib/tls/libpthread. so. 0 /libresolv. so. 2 /usr/X 11 R 6/lib. X 11. so. 6 /usr. X 11 R 6/lib. Xext. so. 6 Prog Num 1831 1084 684 596 569 438 424 412
![Programs with Most Libs Program Name Ximianconnectorsetup2 0 Evolution2 0 Nautilus Number of Libraries Programs with Most Libs Program Name Ximian-connector-setup-2. 0 Evolution-2. 0 Nautilus Number of Libraries](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-24.jpg)
Programs with Most Libs Program Name Ximian-connector-setup-2. 0 Evolution-2. 0 Nautilus Number of Libraries 87 75 70 Nautilus-file-management-properties 70 Srcore 70 Gnomemeeting 68 Create-branching-keyboard 67 Devhelp 67 Gok 67
![Future Work Build some much larger standard programs in both versions and compare Future Work ¡ Build some much larger standard programs in both versions and compare](https://slidetodoc.com/presentation_image/01c2e2396b0285cdd5f01110ad8d7132/image-25.jpg)
Future Work ¡ Build some much larger standard programs in both versions and compare them. ¡ Construct an entire system distribution both statically and dynamically to evaluate the performance.
Static vs dynamic linking
Linking loader and linkage editor
Linking and loading
Static vs dynamic linking
Xiaomin qian purdue
Static image vs dynamic image
Network interconnection studies
Dynamic vs static character
Static vs dynamic data structure
Static and dynamic hashing in dbms
Static content vs dynamic content
Types of protagonist
Branch prediction techniques
Bernoulli rule of integration
What is static hashing in dbms
Difference between dynamic and static routing
Static transformer definition
Difference between flat and static character
Difference between static and dynamic analysis
Five components of multimedia
Difference between static and dynamic characters
Statuc character
Static vs dynamic data
Static and dynamic anthropometry
Cs3250
Dynamic and static