Source‑code protection – end users receive only a binary, reducing IP risk.
Static type checking catches many errors before the program runs.
Predictable resource usage – memory and CPU requirements are known from the compiled binary.
Drawbacks
Longer development cycle – every change requires a recompilation step.
Platform dependence – a binary compiled for one architecture (e.g. x86) will not run on another (e.g. ARM) without recompilation.
Higher compilation resource demand – large projects may need substantial RAM and CPU time during the build.
Debugging difficulty – the executing code is not the original source; source‑level debugging relies on symbol tables and line‑number information.
Interpreters
Benefits
Immediate feedback – ideal for interactive development, scripting, and teaching (e.g. Python REPL).
Platform independence – the same source runs on any machine that provides a compatible interpreter.
Smaller initial distribution – source can be shipped directly; no separate binary is required.
Dynamic features – runtime code generation, eval(), and reflective capabilities are easy to implement.
Simpler debugging – errors are reported with the original source line numbers.
Drawbacks
Slower execution – each statement is parsed and evaluated each time it runs.
Limited optimisation – only local, runtime optimisations are possible.
Source exposure – the original code must be present on the target machine.
Later error detection – some errors (e.g. type mismatches) appear only when the offending line is executed.
Higher runtime memory overhead – the interpreter itself occupies memory in addition to the program.
Direct Comparison
Aspect
Compiler
Interpreter
Execution speed
High – native machine code
Low – each statement parsed at run‑time
Development cycle
Longer – edit‑compile‑run‑debug
Shorter – edit‑run‑debug
Portability
Requires recompilation for each target platform
Runs wherever the interpreter exists
Optimisation potential
Extensive static optimisation
Limited, mainly dynamic optimisation
Source‑code exposure
Protected – binary distribution
Exposed – source needed at run‑time
Memory usage
Higher for the final binary, but low runtime overhead
Higher during execution (interpreter + program data)
Error detection
Many errors caught at compile time
Errors may surface only during execution
When to Choose a Compiler
Performance‑critical applications (e.g. video games, scientific simulations, embedded control systems).
Software that will be distributed to end‑users without revealing source code.
Systems with limited run‑time resources where interpreter overhead would be unacceptable.
Projects that benefit from extensive static analysis (type safety, security audits) and optimisation.
When to Choose an Interpreter
Rapid prototyping, scripting, or educational environments where quick feedback is essential.
Cross‑platform tools that must run on many operating systems without recompilation.
Applications requiring dynamic behaviour such as plug‑in architectures, runtime code loading, or interactive command shells.
Small utilities or one‑off scripts where development speed outweighs execution speed.
Justifying the Choice – A Structured Approach (Exam Checklist)
Identify the key requirements – performance, portability, security, development speed, memory constraints.
Match requirements to translator characteristics – use the comparison table to find the best fit.
State the chosen approach and give at least two concrete reasons (e.g. “A compiler is preferred because the application processes large data sets in real‑time, and native code provides the necessary speed”).
Consider hybrid solutions – mention byte‑code or JIT compilation if the question allows a nuanced answer.
Hybrid Approaches (Byte‑code + JIT)
Modern languages often combine the advantages of both techniques:
Java – source → byte‑code (platform‑independent) → executed by the JVM, which may JIT‑compile hot spots to native code.
Python (CPython) – source → byte‑code → interpreted; alternative implementations (PyPy) use JIT for speed.
C# – source → MSIL (Microsoft Intermediate Language) → JIT‑compiled by the .NET CLR.
These hybrid models provide portability (via an intermediate representation) and speed (via just‑in‑time optimisation).
Suggested Diagram (for classroom use)
Typical compilation pipeline vs. interpretation flow.
5.1 Operating Systems
Purpose & Core Functions
Resource management – CPU scheduling, memory allocation, I/O handling.
File system services – creation, deletion, access control, hierarchical directories.
Security & protection – user authentication, permission bits, isolation between processes.
User interface – command‑line shells, graphical desktops.
Identify the syllabus area the question belongs to (e.g., Language Translators, OS, Algorithms).
Recall the key definitions, core concepts, and one representative example.
Use the comparison tables or bullet‑point lists to structure your answer.
Where appropriate, justify choices with at least two concrete reasons.
For A‑Level questions, consider hybrid or advanced options (JIT, parallelism, security).
Support e-Consult Kenya
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources,
past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.