The lib64 folder in the Linux system contains: dynamic link library, static link library, kernel module, etc.

The lib64 directory plays an important role in the stable operation of the system.

lib64 file

The lib64 folder mainly stores 64-bit code modules that can be directly loaded and used by the program, including dynamic libraries, static libraries, kernel modules, etc. These files are crucial to the running of the program.

In Linux systems, the lib64 folder is usually used to store binary files of 64-bit library files.
There are mainly the following types of files:

  1. Dynamic Link Library Files (.so): These are shared libraries that can be loaded and linked directly by programs as .sofile extensions. Such as libopencv.so.

  2. Static Link Library Files (.a): These are static archive files, used for static linking, with .athe extension . eg libxxx.a.

  3. Linux kernel module file (.ko): Some modules that can be dynamically loaded by the kernel .kohave an extension.

  4. Program execution files: some program execution files will also be placed in the lib64 folder, such as /usr/lib64/firefox and so on.

  5. Configuration files, documentation, etc.

  6. Compared with the lib folder, lib64 is specially used to store 64-bit library files, while lib is a 32-bit version of the library. This is necessary when supporting multiple systems.
    insert image description here

dynamic link library

Dynamic libraries generally use files on Linux .soand files on Windows .dll. Writing a dynamic library makes the code widely reusable, which is an important way of software reuse. Dynamic linking makes program upgrade and deployment more flexible.

A dynamic link library (Dynamic Link Library, DLL) is a library file that contains code and data that can be shared by multiple programs. It can be dynamically loaded when the program is running, rather than statically loaded when linking.

The main characteristics of a dynamic link library include:

  • Sharing: Multiple programs can use a dynamic library at the same time, reducing duplication of code.

  • Dynamic loading: The program loads the dynamic library at runtime, not at compile time.

  • Version management: Dynamic libraries can be upgraded individually without recompiling the program.

  • Dependency management: clearly define the dependencies of the library, and load the required library on demand.

  • Language neutrality: Support multiple language calls, such as C, C++, Rust, etc.

  • Runtime link: The program does not need to contain dynamic library code, and only performs symbol resolution and relocation at runtime.

  • Space saving: multiple programs share the same block of memory, reducing memory usage.

static link library

A static library can be regarded as a code segment that is directly inserted into the target program when compiling. Its main advantage is that it is easy to transplant, but its disadvantages are that it takes up a lot of space and has many repeated codes.

A static link library (Static Library) is a library file that is integrated into the target program during the program compilation and linking phase, as opposed to a dynamic link library.

The main characteristics of a static library:

  • Static addition: The static library is integrated into the target program at compile time, rather than dynamically loaded at runtime.

  • Independent existence: A static library is an independent file that can be reused.

  • No version management: The program uses a snapshot of the static library every time, which is inconvenient for version upgrades.

  • Duplicated code: If multiple programs link against the same static library, there will be duplicated code.

  • Portability: The static library can be packaged and deployed together with the program, without the need to install the library environment.

  • Language-related: Static libraries are usually compiled in a specific language, such as C++.

  • Compile time growth: Increased compile link time.

  • Increase executable size: Library code is added to the executable.

kernel module

The kernel module mechanism is a very important design of the Linux kernel, which can dynamically expand kernel functions, develop kernel drivers, etc., without frequently recompiling the kernel. It is the key to realize the extensibility of Linux kernel.

A kernel module file is a code module that can be dynamically inserted into the kernel (Linux Kernel), usually with an .koextension.

Several main characteristics of kernel modules:

  • Dynamic insertion: The kernel can be dynamically inserted and run through the insmod/modprobe command when the system is running, without restarting.

  • Unloadable: Modules can be dynamically unloaded from the running kernel using the rmmod command.

  • Extending the Kernel: You can extend the functionality of the kernel without modifying the kernel source code.

  • Hardware support: Many hardware driver functions are implemented as kernel modules.

  • Dependency management: dependencies on other kernel modules or symbols can be declared.

  • Version Control: Kernel modules can be updated independently of the kernel.

  • Optimized reuse: Multiple cores can reuse the same module to optimize memory usage.

  • Accelerated development: Independent kernel development and packaged modules can speed up development.

Guess you like

Origin blog.csdn.net/qq_40280673/article/details/132356691