OCR A-Level Computer Science H446
Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation
Software Development
Types of Programming Language
Exchanging Data
Networks
Web Technologies
Data Types and Number Representation
Data Structures
Boolean Algebra
Legal, Moral, Cultural and Ethical Issues
Elements of Computational Thinking
Problem Solving and Programming
Algorithms
Applications Generation
Linkers, loaders and libraries
- 1 thing to know
- Component 01
Overview
Recall questions on linkers and loaders and the difference between them, libraries and their advantages and disadvantages, static and dynamic linking compared, and patching a vulnerable library under each kind of linking.
What you need to know
Answer each one before you reveal it.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is a linker?
Model answer
A program that combines the separate object files produced by compiling the parts of a program, together with any library code they use, into a single executable file. It resolves the references between them, so that a call in one module to a subroutine defined in another is given the correct address.
- 2
Why is a linker needed at all?
Model answer
Large programs are written and compiled as separate modules, and they also use code from libraries that was compiled long before. Each module is compiled without knowing where the others will sit in memory, so its references to their subroutines and variables are left unresolved. The linker brings all the pieces together, fixes the addresses so every reference points at the right place, and produces one file that can actually be run.
- 3
What is a loader?
Model answer
A part of the operating system that copies an executable program from secondary storage into main memory, places its code and data at the addresses it will use, sets up the program counter and stack, and starts execution. Where dynamic linking is used, the loader is also responsible for finding and bringing in the required library files.
- 4
State the difference between a linker and a loader.
Model answer
The linker runs before the program is ever executed, combining object files and libraries into one executable and resolving the references between them. The loader runs each time the program is started, bringing that executable from storage into RAM and transferring control to it. The linker builds the program; the loader launches it.
- 5
What is a library, in the context of program development?
Model answer
A collection of pre-written, pre-compiled and tested subroutines, classes or functions for common tasks - mathematical operations, sorting, graphics, encryption, file and network access - that a programmer can call from their own code rather than writing the same thing again.
- 6
Give three advantages of using libraries.
Model answer
Development is much faster, because standard tasks do not have to be written from scratch. The code is already thoroughly tested and debugged by many users, so it is likely to be more reliable than a fresh implementation. It is often written by specialists and highly optimised, and in areas such as cryptography an amateur implementation would be dangerously weak. Libraries are also maintained separately, so improvements and security fixes can be picked up without rewriting your own program.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Applications Generation, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.