0% found this document useful (0 votes)
231 views3 pages

Subroutine Linkage, Overlays & General Loading Scheme (Sppu)

The document discusses subroutine linkage and overlays, detailing their definitions, processes, advantages, and disadvantages. It also explains the general loading scheme, outlining the steps from source program to execution, including the roles of the compiler, linker, and loader. The conclusion emphasizes the importance of these concepts in managing control transfer, memory limitations, and efficient program execution.

Uploaded by

abhipathak416
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
231 views3 pages

Subroutine Linkage, Overlays & General Loading Scheme (Sppu)

The document discusses subroutine linkage and overlays, detailing their definitions, processes, advantages, and disadvantages. It also explains the general loading scheme, outlining the steps from source program to execution, including the roles of the compiler, linker, and loader. The conclusion emphasizes the importance of these concepts in managing control transfer, memory limitations, and efficient program execution.

Uploaded by

abhipathak416
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Short Notes + General Loading Scheme (SPPU – 18

Marks)

Q1) Write short notes on: [10 Marks]

i) Subroutine Linkage (5M)

• Definition: A subroutine (procedure/function) is a block of code designed to perform a specific task,


which can be called from multiple places in the program.
• Subroutine linkage is the mechanism of transferring control to the subroutine and back to the
calling program.

Steps in Subroutine Linkage: 1. Call instruction transfers control to subroutine’s starting address. 2. The
return address (next instruction of caller) is saved (stack/register). 3. Subroutine executes using local data/
parameters. 4. Return instruction transfers control back to caller using saved address.

Types: - Call by value / reference (parameter passing mechanisms). - Static vs Dynamic linkage (fixed at
compile time vs resolved at runtime).

Advantages: - Promotes code reusability. - Simplifies programming (modularity). - Saves memory


(common routine used by many parts).

ii) Overlays (5M)

• Definition: Overlay is a technique used when the program is larger than the available memory.
Program is divided into modules (segments) such that only the required part (overlay) is loaded into
memory at a time.

Concept: - Resident portion (main control module) always remains in memory. - Overlay modules are
swapped in/out of memory when required.

Process: 1. Program divided into mutually exclusive overlays. 2. Loader loads the required overlay into
memory area. 3. Control is transferred to overlay code. 4. When finished, memory is reused for another
overlay.

Advantages: - Enables execution of large programs in limited memory. - Efficient use of RAM.

Disadvantages: - Programmer/OS must manage overlay structure. - Increases complexity of program


design.

Applications: - Early systems with very limited memory. - Still used in embedded systems.

1
Q2) With the help of diagram explain General Loading Scheme. [8
Marks]

Definition

A loader is a system program that loads machine code from secondary storage into main memory for
execution. The general loading scheme shows the complete process from source program to execution.

Steps in General Loading Scheme

1. Source Program: Written in high-level or assembly language.


2. Assembler/Compiler: Translates source code into object code (machine instructions + relocation
info + symbol table).
3. Linker: Combines multiple object modules, resolves external references, performs relocation, and
produces a linked object/executable.
4. Loader: Loads the executable into memory, assigns actual addresses, and starts execution.

Block Diagram

+-----------------+ +-----------------+ +-----------------+


+----------------+
| Source Program | --> | Compiler/ | --> | Linker | --> | Loader
+ Memory|
| (.c / .asm) | | Assembler | | (Relocation + | |
(Executable) |
| | | (Object Code) | | Linking) |
| |
+-----------------+ +-----------------+ +-----------------+
+----------------+
|
v

+-----------+
| Execution
|

+-----------+

Characteristics

• Ensures proper translation, linking, and relocation before execution.


• Produces efficient, reusable executables.
• Supports multi-module programs and libraries.

2
Exam-Oriented Conclusion
• Subroutine linkage ensures smooth control transfer between caller and subroutine.
• Overlays manage memory limitations by swapping code modules.
• General Loading Scheme shows the complete pipeline: Source → Compilation → Linking → Loading
→ Execution. Together, these concepts highlight the role of loaders and linkers in efficient program
execution.

You might also like