answersLogoWhite

0

What is re-entrant code?

Updated: 8/11/2023
User Avatar

Wiki User

10y ago

Best Answer

A reentrant function is a function which can be safely executed concurrently. This means it should allow a re-entry while it is running. The reentrant function should work only on the data given by the calling function. It must not have any static data also.

The term "reentrant" is used to refer to side wall profiles of the nozzles, wherein exit diameters of the nozzles are smaller than entrance diameters of the nozzles so that the side walls of the nozzles are not perpendicular to a plane defined by an exit surface of the nozzle member.

A Re entrant function is a function which guaranteed that which can be work well under multi threaded environment.

mean while function is access by one thread, another thread can call it... mean there is separate execution stack and handling for each...

So function should not contain any static or shared variable which can harm or disturb the execution..

mean it should not contain any static or shared variable....

Mean function which can be called by thread, while running from another thread safely...... and properly.... hope I have answered the correct thing....

And of course rem that re-entrant function is not same as recursive function.... totally different concept....

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

Re-entrant code is code that is able to be executed multiple times, often from within it own body, or in the case of interrupts, at arbitrary points of time. The primary constraint to re-entrant code is that it does not modify anything except for the stack or registers. A classic example of re-entrant code is this code snippet that calculates factorial numbers...

long nfact (long n) {

if (n==2) return n; else return n * nfact (n-1);

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is re-entrant code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a 7 sided shape called with 4 right angles?

This would be a type of concave or reentrant polygon, but might also have a specific name, perhaps a concave heptagon, or a reentrant heptagon.


What kind of polygon has the property that there is a line which contains a side of the polygon and passes through the interior of the polygon?

It is a concave or reentrant polygon.


What is the concept of Reentrancy?

It is a useful, memory-saving technique for multiprogrammed timesharing systems. A Reentrant Procedure is one in which multiple users can share a single copy of a program during the same period. Reentrancy has 2 key aspects: The program code cannot modify itself, and the local data for each user process must be stored separately. Thus, the permanent part is the code, and the temporary part is the pointer back to the calling program and local variables used by that program. Each execution instance is called activation. It executes the code in the permanent part, but has its own copy of local variables/parameters. The temporary part associated with each activation is the activation record. Generally, the activation record is kept on the stack.Note: A reentrant procedure can be interrupted and called by an interrupting program, and still execute correctly on returning to the procedure.


What is reentrant kernel?

A reentrant kernel enables processes to give away the CPU while in kernel mode ,not hindering other processes from also entering kernel mode. A typical use is IO wait. The processes wants to read a file..It calls a kernel function for this. Inside the kernel function,the disk controller is asked for the data . Getting the data will take some time & the function is blocked during that time. With an reentrant kernel,the scheduler will assign CPU to another process until an interrupt from disk controller indicates that the data is available and our thread can be resumed . This process can still access IO,like user input


What is a definition for non convex polygon?

A simple polygon that is not convex is called concave, non-convex or reentrant. A concave polygon will always have an interior angle with a measure that is greater than 180 degrees.


What is reentrant code and its significance in memory management?

In operating systems and other multithreaded, event-driven, or low-level software, it is possible to have event-handling or interrupt-handling code that is called every time an event or interrupt is triggered by hardware or software. If an event triggers a call to the handler, then the code will context switch to "enter" that method. Once in the method, suppose that it accesses a set of static structures in memory, so that they can be modified (like a counter or a routine that reads and updates the data). Now, suppose that another thread or process triggers an event to call the same method. This will enter the same handler method at the same time (a reentrant block of code). Well, while the first method is still accessing the static memory location, the second thread/process will be entering the same method to do the same thing, and they will attempt to modify the same area of memory at the same time. This is called a race condition. In order to prevent this from happening, memory management in the OS kernel should "lock" the memory location so that no other processes can overwrite that memory at the same time. They will encounter the lock and will either wait until the locked memory has been unlocked by the first routine, or they will exit. Typically, if locks are not accounted for, and two threads are dependent upon each other, a deadlock condition can also be reached, which freezes the system.


Are nuclear power plants and nuclear medicine plants in the same building?

I don't know of any such arrangement. Medical isotopes are produced in small research type reactors where samples can be introduced into the neutron flux in reentrant tubes (commonly called thimbles) and irradiated, then quickly removed and used. Large commercial power reactors don't have these facilities.


Name a word that ends with code?

Area code Zip code Morse code Security code Bar code Dress code Pass code Color code


Papyrus Code Code of Hammurabi Code of Cinithis?

Papyrus Code Code of Hammurabi Code of Cinithis Rosetta Code These are examples of ancient moral codes.


What Is The Code To Show An Html A Text?

<code><code>HTML TEXT HERE</code></code>


What is the code for levels 1 to 10?

Code 1=hongha code 2=hoankiem code 3=hnams code 4=dhyhn code 5=anba code 6=khoamoc code 7=diepdin code 8=meyen code 9=bominh code 10=emyeu


What is the zip code for Rockford IL?

Rockford IL possible zip codes. * ZIP Code 61101 * ZIP Code 61102 * ZIP Code 61103 * ZIP Code 61104 * ZIP Code 61105 * ZIP Code 61106 * ZIP Code 61107 * ZIP Code 61108 * ZIP Code 61109 * ZIP Code 61110 * ZIP Code 61112 * ZIP Code 61114 * ZIP Code 61125 * ZIP Code 61126