Re: Reentrant code / Critical section / Atomic Section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




"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:
  1. It never modifies itself. That is, the instructions of the program are never changed. Period. Under any circumstances. 
  2. 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/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux