Implementation of thread-static data in multi-threaded computer systems

   
   

One of the primary difficulties that result from using static variables in multi-threaded computer programs is that changes to a static variable made by one thread will be seen by all other threads operating within the same process. Multiple threads cannot use static variables separately because other threads within the process can overwrite the values stored at the variable memory location. Thus, the development of multi-threaded programs using static variables often requires explicit thread harmonization by the programmer. Another problem is that threads within the same process must use unique static variable IDs to avoid reading or writing to the location of another static variable. This also requires thread harmonization by the programmer. Accordingly, in view of the shortcomings associated with existing thread-static data implementations, there remains a need for an efficient thread-static data implementation that can be used on most modern operating systems. The present invention provides embodiments of a method, data processing system, and computer program product that efficiently implements thread-static data without registering pointers. The present invention efficiently implements static thread data in a multi-threaded program. The static thread data of each thread is allocated to the top of the virtual memory block belonging to the corresponding stack of each thread. An address mask is created for each thread so as to extract the base address of the static thread data region of the stack for each thread from the corresponding stack pointer. When a thread in execution needs to access its static thread data, it accesses the static thread data variable according to the virtual memory address extracted from the stack pointer using the address mask.

 
Web www.patentalert.com

< Method and apparatus for synchronized previewing user-interface appearance on multiple platforms

< Video/text bi-directional linkage for software fault clearance applications

> Method, system, computer program product, and article of manufacture for construction of a computer application interface for consumption by a connector builder

> Methods and systems for providing information based on similarity

~ 00191