Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
11 user(s) are online (10 user(s) are browsing encyclopedia)

Members: 0
Guests: 11

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Reentrant

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 computer process. 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 computer multitasking.

The kernel code or the code implementing synchronization like Semaphore_(programming) is generally not reentrant because it handles the shared memory.

= Examples =

In the following piece of code, both functions f and g are not reentrant.

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

In the above, f depends on a global variable g_var ; thus, if two processes execute it and access to 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.

= See also =

  • Thread-safe
  • = External links =

  • Article [http://www-106.ibm.com/developerworks/linux/library/l-reent.html Use reentrant functions for safer signal handling] by Dipak K. Jha
  • [http://www.unet.univie.ac.at/aix/aixprggd/genprogc/writing_reentrant_thread_safe_code.htm Writing Reentrant and Thread-Safe Code]