answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is reentrant code and its significance in memory management?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you hack on starcraft?

By knowing how to code & memory management.


Functions of the memory manager?

Memory management functions handle the allocation and deallocationof dynamic Memory. These functions form an abstraction layer above the standard C memory management functionsmalloc, free, and realloc.This block of functions can be replaced by the user with custom code to implement a different memory management scheme. For example, an embedded system application might want to use a fixed-sized static block from which to allocate.


Do you have destructer in java?

No. Memory management is handled automatically in Java, so there is no need for a destructor. Also, you can use a finalize block of code where you can assign all large objects to null. This can significantly aid the memory management a.k.a garbage collection done by the JVM.


Difference between MS-DOS and Window XP Memory Management?

DOS Memory Management: Under MS-DOS, device driver and TSR modules can take up large amounts of conventional memory. A memory manager can move some of these into upper memory blocks or the High Memory Area, freeing up conventional&memory and creating a larger TPA. Memory managers also control access to extended memory, allowing it to be accessed via XMS, or as expanded memory via EMS. Popular DOS memory mangers include EMM386 and QEMM.Windows Memory Management: Memory management in Microsoft Windows operating systems has evolved into a rich and sophisticated architecture, capable of scaling from the tiny embedded platforms (where Windows executes from ROM) all the way up to the multi-terabyte NUMA configurations, taking full advantage of all capabilities of existing and future hardware designs. With each release of Windows, memory management supports many new features and capabilities. Advances in algorithms and techniques yield a rich and sophisticated code base, which is maintained as a single code base for all platforms and SKUs. Memory management improvements in Windows Vista focused on areas such as dynamic system address space, enhanced NUMA and large system/page support, advanced video model support, I/O and section access, and robustness and diagnosability.


When was International Cyanide Management Code created?

International Cyanide Management Code was created in 2002.


What is data segment memory and code segment memory?

Code Segment, in which all the application code is stored Data Segment, that holds the global data


What memory stores bootstrap code?

RAM - Random-Access Memory


Code to Unlock memory card for nokia 6600?

The code for the memory card - will be whatever YOU chose to set it ! WE cannot help you !


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 was the significance of Samuel Morse?

He created Morse Code.


Program code is stored in?

Memory.


When was Electronic Commerce Code Management Association created?

Electronic Commerce Code Management Association was created in 1999.