Module properties — safe multi-instance execution: In which type of module can multiple executions overlap in time and still produce the same correct result?

Difficulty: Easy

Correct Answer: reenterable module

Explanation:

Introduction / Context:Systems programming often requires routines that can be invoked concurrently (e.g., by interrupts or multiple tasks). Such routines must be designed to be safely reentered without corrupting state.

Given Data / Assumptions:

  • “Multiple instances of execution” may interleave or overlap.
  • Correctness must be preserved regardless of overlapping calls.

Concept / Approach:A reenterable (reentrant) module contains no hidden writable shared state, or protects it appropriately. Its code is pure (read-only), and any writable data is on per-invocation stacks or passed explicitly, allowing simultaneous execution by different callers without interference.

Step-by-Step Solution:Identify need: safe overlapping calls.Match term: “reenterable module” is specifically defined for this property.Eliminate alternatives: “serially reusable” requires one-at-a-time execution.

Verification / Alternative check:Operating systems specify reentrancy for interrupt service routines and library functions, ensuring safety under concurrency.

Why Other Options Are Wrong:(a) Non-reusable cannot be safely reused. (b) Serially reusable forbids overlap. (d) Recursive is about self-calls depth, not safe concurrency. (e) Interrupt-driven describes invocation mechanism, not concurrency safety.

Common Pitfalls:Confusing recursion with reentrancy; they are independent concepts.

Final Answer:reenterable module.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion