Difficulty: Easy
Correct Answer: reenterable
Explanation:
Introduction / Context:
Operating systems often allow multiple processes to use the same program code in memory to save RAM and improve performance. For this to work safely, the code must satisfy specific constraints so that simultaneous entries do not corrupt state.
Given Data / Assumptions:
Concept / Approach:
Reenterable (pure) code is position-independent, contains no self-modifying instructions, and keeps mutable data in separate data segments or per-process stacks. This allows the OS to map one copy of the executable code pages into many processes, reducing memory footprint and avoiding interference among them.
Step-by-Step Solution:
Verification / Alternative check:
Modern shared libraries and OS loaders rely on reentrancy and relocation to share code segments and keep writable state separate (copy-on-write data pages if needed).
Why Other Options Are Wrong:
Common Pitfalls:
Confusing “thread-safe” with “reenterable” (related but not identical); assuming all code can be shared without considering writable static data or global state.
Final Answer:
reenterable
Discussion & Comments