critical sections - thread-safety and re-entrancy
Re-entrant function definitions:
- Code which can have multiple simultaneous, interleaved, or nested invocations which will not interfere with each other.
- A function is reentrant if, while it is being executed, it can be re-invoked by itself (recursion), or by any other routine, by interrupting the present execution for a while.
- A description of code which is either re-entrant or protected from multiple simultaneous execution by some form of mutual exclusion.
- A function which can be called simultaneously by multiple threads when each invocation references shared data.
- Re-entrancy is stronger condition of the two (Thread-safety and Reentrancy).
- Thread-safety guarantees mutual exclusion or serialized access of shared resources that may be modified. Re-entrancy guarantees no shared resources or just read-only access to shared resources and maintenance of local state for every re-entry.
- Every re-entrant function is necessarily thread-safe, but vice-versa is false.
0 Comments:
Post a Comment
<< Home