"Reentrant code" is a piece of code that could be simultaneously
running by multiple threads of execution. (either via SMP, or via
preemption on uniprocessor machines)
A piece of code is reentrant if, while it is being executed, it can be re-invoked by itself, or by any other routine, by interrupting the present execution for a while.
must satisfy conditions for 'reentrancy' of a code:
- It never modifies itself. That is, the instructions of the
program are never changed. Period. Under any circumstances.
- Any variables changed by the routine must be allocated to
a particular "instance" of the function's invocation. so if a function is called from three different threads then its data should get stored in three different areas of memory.
(by avoiding global/static data access)
In that sense "Reentrant Code" seems to be just the opposite of
"Critical Section". Is this right?
No.
Thanks,
Dan
thanks,
-Manoj
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/