The Wayback Machine - https://web.archive.org/web/20240925222536/https://www.geeksforgeeks.org/difference-between-loading-and-linking/
Open In App

Difference between Loading and Linking in Operating System

Last Updated : 22 Feb, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

An operating system acts as an intermediary between the user of a computer and computer hardware. The purpose of an operating system is to provide an environment in which a user can execute programs conveniently and efficiently.

Linking and Loading are utility programs that play an important role in the execution of a program. Linking intakes the object codes generated by the assembler and combines them to generate the executable module. On the other hand, the loading loads this executable module to the main memory for execution. 

What is Loading?

To bring the program from secondary memory to main memory is called Loading. It is performed by a loader.  It is a special program that takes the input of executable files from the linker, loads it to the main memory, and prepares this code for execution by a computer. There are two types of loading in the operating system:

  • Static Loading:
    • Loading the entire program into the main memory before the start of the program execution is called static loading.
    • If static loading is used then accordingly static linking is applied.
  • Dynamic Loading: 
    • Loading the program into the main memory on demand is called dynamic loading.
    • If dynamic loading is used then accordingly dynamic linking is applied.

What is Linking?

Establishing the linking between all the modules or all the functions of the program in order to continue the program execution is called linking. Linking is a process of collecting and maintaining pieces of code and data into a single file. Linker also links a particular module into the system library. It takes object modules from the assembler as input and forms an executable file as output for the loader. Linking is performed at both compile time when the source code is translated into machine code, and load time, when the program is loaded into memory by the loader. Linking is performed at the last step in compiling a program.

  • Static Linking: 
    • A statically linked program takes constant load time every time it is loaded into the memory for execution.
    • Static linking is performed by programs called linkers as the last step in compiling a program. Linkers are also called link editors.
    • In static linking, if any of the external programs has changed then they have to be recompiled and re-linked again else the changes won’t reflect in the existing executable file.
  • Dynamic Linking:
    • Dynamic linking is performed at run time by the operating system.
    • In dynamic linking, this is not the case and individual shared modules can be updated and recompiled. This is one of the greatest advantages dynamic linking offers.
    • In dynamic linking load time might be reduced if the shared library code is already present in memory.

For more information please refer to the Static and Dynamic Linking in Operating Systems article.

Loading and Linking in Operating System

 

Differences between Linking and Loading

Linking

Loading

The process of collecting and maintaining pieces of code and data into a single file is known as Linking in the operating system. Loading is the process of loading the program from secondary memory to the main memory for execution.
Linking is used to join all the modules. Loading is used to allocate the address to all executable files and this task is done by the loader.
Linking is performed with the help of Linker. In an operating system, Linker is a program that helps to link object modules of a program into a single object file. It is also called a link editor. A loader is a program that places programs into memory and prepares them for execution.
Linkers are an important part of the software development process because they enable separate compilation. Apart from that organizing a large application as one monolithic source file, we can decompose it into smaller, more
manageable modules that can be modified and compiled separately.
The loader is responsible for the allocation, linking, relocation, and loading of the operating system.


Similar Reads

Difference Between Static andDynamic Loading in Operating System
An operating system is a program loaded into a system or computer. and manage all the other program which is running on that OS Program, it manages the all other application programs. or in other words, we can say that the OS is an interface between the user and computer hardware. Static Loading in OS In static loading, Initially, the complete prog
5 min read
Static and Dynamic Linking in Operating Systems
Static Linking: When we click the .exe (executable) file of the program and it starts running, all the necessary contents of the binary file have been loaded into the process's virtual address space. However, most programs also need to run functions from the system libraries, and these library functions also need to be loaded. In the simplest case,
3 min read
Difference between System Software and Operating System
Software is like a set of instructions that tell a computer what to do. There are two main types application software and system software. Application software is extra programs you can add to your computer to do specific things, like write documents or play games. You don't need these to use your computer, but they help you do particular tasks. Sy
5 min read
Difference between Hardware and Operating System
1. Hardware : Computer Hardware, as name suggest, are simply physical components or machinery or equipment's of computer that are hard, tangible as well as considered heart of computer without which computer cannot function. 2. Operating System : Operating System, as name suggests, is simply a system software runs on computer that manages all appli
3 min read
Difference Between QNX and VxWorks Operating System
QNX stands for QNX is Not Unix. QNX is a Unix-like Real Time Operating System, which is dedicated primarily to the field of embedded systems. QNX was launched in 1982. Blackberry Limited owns it. QNX is built on the Mach microkernel and runs on a variety of processors including ARM, MIPS, Power PC, and x86 architectures. In 2015, over 6 million dev
3 min read
Difference Between LRU and FIFO Page Replacement Algorithms in Operating System
Page replacement algorithms are used in operating systems to manage memory effectively. Page replacement algorithms are essential in operating systems for efficient memory management. These algorithms select which memory pages should be changed when a new page is brought. Least Recently Used (LRU) and First-In-First-Out (FIFO) are two popular page
3 min read
Difference Between Lock variable and Turn variable in Operating System
In operating systems, effe­ctive and reliable synchronization me­chanisms play a vital role in managing concurrency and coordinating the activitie­s of multiple processes or thre­ads. Two essential tools for synchronization are lock variable­s and turn variables, each serving distinct purpose­s and having unique characteristics. In this article, we
4 min read
Difference Between Application Software and Operating System
A computer can only carry out certain tasks with the help of software, which is a set of guidelines or instructions. Software can be broadly divided into two categories: system software and application software. The primary program on a computer that has direct access to the hardware of the system is called system software. It looks after and keeps
5 min read
Difference Between AIX and Solaris Operating System
An Operating System (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. In this article, we will learn the difference between AIX and Solaris. What is the AIX Operating System?AIX is a series of proprietary operating systems which is provided by IBM. AIX stands for Advanced I
3 min read
Difference Between Linux and AIX Operating System
Linux and AIX are widely used operating systems that cater to different needs and environments in computing globally. While Linux is an open-source running gadget extensively used in various computing platforms, including servers, desktops, and embedded structures, AIX is a Unix-primarily based running system advanced via IBM mostly for organizatio
6 min read
Difference Between Carriage Return (CR) and Line Feed (LF) ? How it is used in Different Operating System?
While using text files in scripts on different operating systems, you may be concerned with different newline characters, which can also lead to confusion and file incompatibility. Two primary characters are used to denote the end of a line: Carriage Return (CR) and another command called Line Feed (LF). This article will explain their History, Usa
8 min read
Difference Between Host and Guest Operating System
An Operating System (OS) can be defined as a mediator, which works between the software & hardware of a computer The common task of OS includes memory management, managing different resources, device management, file handling, and others. Examples of some popular OS are Linux, MacOS, and Windows. In this article, we will see the difference betw
6 min read
Difference between page and block in operating system
In an operating system, a block is a variable-size storage that can either read a file or write data into a file. The page is a fixed-size memory unit that can be loaded into the processor from main memory. In this article, we will provide an overview of the page and block in the operating system and then discuss the differences by mentioning the f
7 min read
Difference between Operating System and Kernel
In the world of computing, two terms that are frequently mentioned are Operating System (OS) and Kernel. While they are closely related, they serve different purposes within a computer system. Understanding the difference between the two can help clarify how computers function and why both are essential for smooth operation. In this article, we wil
4 min read
Difference between UNIX and Windows Operating System
This makes it even more important to know the differences between UNIX and Windows Operating Systems in our daily, academic and scientific use. UNIX, which is characterized by its high performance and flexibility, is preferred in stable environments that demand strong control. On the other hand, Windows due to its point-and-click graphical shell an
8 min read
Traps and System Calls in Operating System (OS)
Traps and system calls are two mechanisms used by an operating system (OS) to perform privileged operations and interact with user-level programs. Here is an overview of each mechanism: Traps: A trap is an interrupt generated by the CPU when a user-level program attempts to execute a privileged instruction or encounters an error. When a trap occurs
3 min read
Difference Between DOS, Linux & Windows Operating System
This article focuses on discussing the differences between the three different operating systems, DOS, Windows, and Linux. DOS: DOS stands for Disk Operating System, which is an operating system that was popular till 1995 in IBM PCs. It is a single-tasking OS i.e., it can perform one task at a time. It is based on a command-line interface where one
4 min read
List of “Difference Between” Operating System (OS) Topics
Operating System is system software and it works as an interface between the user and computer hardware as it provides interaction between them. Operating systems provide an environment in which a user can conveniently execute programs and solve their problem easily. Operating System is a collection of a set of programs, which manages every resourc
5 min read
System Protection in Operating System
Introduction: System protection in an operating system refers to the mechanisms implemented by the operating system to ensure the security and integrity of the system. System protection involves various techniques to prevent unauthorized access, misuse, or modification of the operating system and its resources. There are several ways in which an op
3 min read
User View Vs Hardware View Vs System View of Operating System
User View of Operating System: The Operating System is an interface, hides the details which must be performed and present a virtual machine to the user that makes it easier to use. Operating System provides the following services to the user. Execution of a programAccess to I/O devicesControlled access to filesError detection (Hardware failures, a
1 min read
Xv6 Operating System -adding a new system call
Prerequisite - Xv6 Operating System -add a user program In last post we got to know how to add user program in Xv6 Operating System. Now here you will see how to add new system call in Xv6 Operating System. A dding new system call to xv6: A system call is way for programs to interact with operating system. A computer program makes system call when
6 min read
Fork System Call in Operating System
In many operating systems, the fork system call is an essential operation. The fork system call allows the creation of a new process. When a process calls the fork(), it duplicates itself, resulting in two processes running at the same time. The new process that is created is called a child process. It is a copy of the parent process. The fork syst
5 min read
System Programs in Operating System
System Programming can be defined as the act of building Systems Software using System Programming Languages. According to Computer Hierarchy, Hardware comes first then is Operating System, System Programs, and finally Application Programs. Program Development and Execution can be done conveniently in System Programs. Some of the System Programs ar
3 min read
File System Implementation in Operating System
A file is a collection of related information. The file system resides on secondary storage and provides efficient and convenient access to the disk by allowing data to be stored, located, and retrieved. File system implementation in an operating system refers to how the file system manages the storage and retrieval of data on a physical storage de
11 min read
Difference Between Nervous System And Endocrine System
The human body has two primary systems that work together to regulate and coordinate body functions, the nervous system and the endocrine system. The nervous system is responsible for quick responses to stimuli, while the endocrine system controls slower, long-lasting changes in the body. In this article, we will discuss the differences between the
3 min read
Difference between Management Information System (MIS) and Decision Support System (DSS)
Decision Support System (DSS) is an interactive, flexible computer based information system or sub-system intended to help decision makers use communication technologies, data, documents to identify and solve problems, complete decision process tasks and make decision. Management Information System (MIS) consists of following three pillars: Managem
2 min read
Difference between Open-Loop Control System and Closed-Loop Control System
Control System is a system in which the behavior of the system is determined by a differential equation. It manages the devices and the systems using control loops. There are Open-Loop Control System and Closed-Loop Control System. Open-Loop Control System is used in applications in which no feedback and error handling are required. It is simple an
3 min read
Difference between Batch Processing System and Online Processing System
Prerequisite - Types of Operating System 1. Batch Processing System : An Batch processing system handles large amounts of data which processed on a routine schedule. Processing occurs after the economic event occurs and is recorded. It requires fewer programming, hardware, and training resources. In this system programs are scheduled through jobs.
3 min read
Difference between Computer Information System and Management Information System
1. Computer Information System (CIS) :Computer Information System, as name suggests, is basically a system composed of people and computer that processes or interprets information and allows organization to communicate in more effective manner. These systems also encourage creative and effective innovation, and make collaboration easier than before
4 min read
Difference Between System.out.print() and System.out.println() Function in Java
In Java, we have the following functions to print anything in the console. System.out.print() andSystem.out.println() But there is a slight difference between both of them, i.e. System.out.println() prints the content and switch to the next line after execution of the statement whereas System.out.print() only prints the content without switching to
2 min read