FACTOID # 84: 41% world's poor people live in India.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Reentrant

A computer program or routine is described as reentrant if it can be safely called recursively or from multiple processes. To be reentrant, a function must hold no static data, must not return a pointer to static data, must work only on the data provided to it by the caller, and must not call non-reentrant functions. A computer program is a collection of instructions that describe a task, or set of tasks, to be carried out by a computer. ... In computer science, a subroutine (function, method, procedure, or subprogram) is a portion of code within a larger program, which performs a specific task and is relatively independent of the remaining code. ... A common method of simplification is to divide a problem into subproblems of the same type. ...


Despite a common misconception, this is not the same as being designed in such a way that a single copy of the program's instructions, in memory, can be shared.


The kernel code or the code implementing synchronization like semaphore is generally not reentrant because it handles the shared memory (i.e., the 'environment', of which there is normally only one instance). Note that multiple levels of 'user/object/process priority' and/or multiprocessing greatly complicate the control of reentrant code. A kernel connects the application software to the hardware of a computer. ... A semaphore is a protected variable (or abstract data type) and constitutes the classic method for restricting access to shared resources (e. ... A priority queue is an abstract data type in computer programming, supporting the following three operations: add an element to the queue with an associated priority remove the element from the queue that has the highest priority, and return it (optionally) peek at the element with highest priority without removing... Multiprocessing is traditionally known as the use of multiple concurrent processes in a system as opposed to a single process at any one instant. ...


Examples

In the following piece of C code, neither functions f nor g are reentrant. C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ...

 int g_var = 1; int f() { g_var = g_var + 2; return g_var; } int g() { return f() + 2; } int main() { g(); return 0; } 

In the above, f depends on a global variable g_var; thus, if two processes execute it and access g_var concurrently, then the result varies depending on the timing of the execution. Hence, f is not reentrant. Neither is g; it calls f, which is not reentrant. [But, in the above C code example, two different processes should have two different copies of the global variable, why will there be any conflict? ] In computer programming, a global variable is a variable that is accessible in every scope. ...


These slightly-altered versions are reentrant:

 int f(int i) { int priv = i; priv = priv + 2; return priv; } int g(int i) { int priv = i; return f(priv) + 2; } int main() { g(1); return 0; } 

See also

Thread-safety is a computer programming concept applicable to multi-threaded programs. ...

External links

  • Article "Use reentrant functions for safer signal handling" by Dipak K Jha
  • Writing Reentrant and Thread-Safe Code

  Results from FactBites:
 
reentrant - definition of reentrant in Encyclopedia (165 words)
A computer program or routine is described as reentrant if it is designed in such a way that a single copy of the program's instructions in memory can be shared by multiple users or separate processes.
The key to designing a reentrant program is to ensure that no portion of the program code is modified by the different users/processes, and that process-unique information (such as local variables) is kept in a separate area of memory that is distinct for each user or process.
Reentrant programming is key to many systems of multitasking.
AV nodal reentrant tachycardia - Wikipedia, the free encyclopedia (299 words)
AV nodal reentrant tachycardia (AVNRT) is a type of reentrant tachycardia (fast rhythm) of the heart.
It is a supraventricular tachycardia, meaning that it involves the atria (upper chambers) of the heart.
This is because the AV node is an essential portion of the reentrant circuit in AVNRT.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.