发明名称 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 wi ll 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 stat ic 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 efficientl y 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 ea ch thread is allocated tothe top of the virtual memory block belonging to the c orresponding 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. Wh en 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 usi ng the address mask.
申请公布号 CA2387200(A1) 申请公布日期 2003.11.22
申请号 CA20022387200 申请日期 2002.05.22
申请人 IBM CANADA LIMITED-IBM CANADA LIMITEE 发明人 HURAS, MATTHEW A.
分类号 G06F9/06;G06F9/40;G06F12/00;G06F12/02;(IPC1-7):G06F12/02 主分类号 G06F9/06
代理机构 代理人
主权项
地址