CN106445656B - A kind of method and device for realizing thread-local storage - Google Patents

A kind of method and device for realizing thread-local storage Download PDF

Info

Publication number
CN106445656B
CN106445656B CN201610806319.2A CN201610806319A CN106445656B CN 106445656 B CN106445656 B CN 106445656B CN 201610806319 A CN201610806319 A CN 201610806319A CN 106445656 B CN106445656 B CN 106445656B
Authority
CN
China
Prior art keywords
variable
global
thread
local
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610806319.2A
Other languages
Chinese (zh)
Other versions
CN106445656A (en
Inventor
邝坚
刘健培
卞佳丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Posts and Telecommunications
Original Assignee
Beijing University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing University of Posts and Telecommunications filed Critical Beijing University of Posts and Telecommunications
Priority to CN201610806319.2A priority Critical patent/CN106445656B/en
Publication of CN106445656A publication Critical patent/CN106445656A/en
Application granted granted Critical
Publication of CN106445656B publication Critical patent/CN106445656B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a kind of method and devices for realizing thread-local storage.Global variable is converted to the thread-local storage variable of task to realize that thread-local stores by method of the invention, comprising: the global variable in source code is revised as global pointer;Increase global pointer address handover operation in the task switching call back function of operating system;Thread-local store tasks local space is distributed for the global variable;The access that variable is stored to the thread-local is completed by the global pointer.According to the method for the present invention and device, global variable can be converted to the TLS variable of task to realize TLS.Method of the invention does not need processor, compiler provides special support, does not modify original operating system yet, has very high degree flexible in application.Method of the invention greatly reduces the enforcement difficulty of TLS, extends the application range of TLS.

Description

A kind of method and device for realizing thread-local storage
Technical field
The present invention relates to computer software technical fields, in particular relate to a kind of method and dress for realizing thread-local storage It sets.
Background technique
The embedded OS of current main-stream is substantially the multiple task operating system for using C language to realize, Er Qiesuo There is the same address space of task sharing.In such systems, variable or data have 2 kinds of basic storage modes: local variable And global variable.Local variable defines in function, and when use is divided in the function call storehouse of each task by compiler automatically Match, local variable will not be shared between each task again;And global variable is the overall situation or static, all tasks access are all Same part data also just influence whether other all tasks if some task is modified it, this meeting is so that make It can not be reentried, can not directly be used under the concurrent environment of this height of multiple task operating system with the function of global variable.
Third-party Open Source Code and library are often used in embedded development field, these source codes are often directed to Linux Unix the operating system environment exploitation that is abstracted with process such as Windows, code is individually compiled for each process Link is translated, there are in the independent address space of process oneself, there is no the concurrent access problems for considering source code.
These codes are used in the multiple task operating system environment of single address space, and new variable is needed to realize machine System, prevent each function call can access but other tasks are from access variable.Industry is commonly referred to as thread-local storage (Thread Local Storage, abbreviation TLS).
Currently, thread-local storage implementation method have it is following several:
1. static state TLS.It is supported jointly by compiler and operating system.It usually needs to become using TLS in source code The place of amount be inserted into specific TLS variable declarations keyword (such as Microsoft added to Visual C++ compiler _ _ Declspec (thread) keyword), then expand compiler, the TLS variable of statement is put into the target text of generation by when compiling In the specific section of part.At runtime, when operating system is loaded into memory the program with TLS section, executable text is found TLS section in part, and a sufficiently large memory block is dynamically distributed, to store all static TLS variables.Using journey It is necessary to being converted to a memory bits for including in storage allocation block when code in sequence quotes one of variable every time It sets.Therefore, compiler must generate some auxiliary codes to quote static state TLS variable, this will make calling program become larger and run Speed reduce.
2. dynamic TLS.Dynamic allocation, access and the release of variable are realized by dedicated thread library function.Such as Pthread thread library can be mentioned by pthread_key_create function dynamic creation TLS variable, Windows by kernel TLS variable is distributed for interface function TLSAlloc.Being achieved in that for such method creates the TLS that thread is specially enjoyed for per thread Variable concordance list, in thread accesses TLS variable, the concordance list by inquiring this thread obtains the ground for the TLS variable to be accessed Location.
It the method for implementation above TLS or needs to expand compiler or needs to provide dedicated function library or needs Processor does special support.In embedded development field, the method for above-mentioned realization TLS has significant limitation.
Therefore, in order to further increase realize TLS method application flexibility, extend the application range of TLS, need one The method of the new realization TLS of kind.
Summary of the invention
In order to further increase the application flexibility for the method for realizing TLS, the application range of TLS is extended, the present invention provides Global variable is converted to the thread-local storage variable of task to realize thread by a kind of method for realizing thread-local storage It is locally stored, comprising:
The global variable in source code is revised as global pointer;
Increase global pointer address handover operation in the task switching call back function of operating system;
Thread-local store tasks local space is distributed for the global variable;
The access that variable is stored to the thread-local is completed by the global pointer.
In one embodiment, global variable is revised as global pointer, wherein be collected into the type of all global variables In one total global data structures body, and generate the global pointer for being directed toward the global data structures body.
In one embodiment, the definition of global variable is annotated, Static-state Space of reallocating when preventing compiler from compiling.
In one embodiment, by the access to global variable, it is revised as the access by global pointer, prevents compiler pair The access of global variable carries out static binding.
In one embodiment, increase the global pointer address switching behaviour in the task switching call back function of operating system Make, in which:
When initialization, the pointer switching function of the thread-local storage variable space is articulated to cutting in operating system system It changes in call back function.
In one embodiment, thread-local store tasks local space is distributed for the global variable, in which:
The task calls thread-local storage variable creation operation, before calling the function containing global variable to work as The local storage space of preceding a global variable of thread distribution.
In one embodiment, the task identification of current task is tied to thread-local storage variable local storage space First address.
In one embodiment, the access that variable is stored to the thread-local is completed by the global pointer, in which:
When operating system carries out task switching, call back function finds its corresponding thread by being cut into the mark of task The first address of variable local storage space is locally stored, gives the address assignment to the global pointer.
In one embodiment, the task calls thread-local storage variable release when not needing using global variable Operation, the local storage space distributed before release.
The invention also provides a kind of device for realizing thread-local storage based on multiple task operating system, described device It is configured to be converted to global variable the thread-local storage variable of task to realize that thread-local stores, described device includes:
Source program modifies unit, is configured to the global variable in source code being revised as global pointer;
It is empty to be configured to the global variable distribution thread-local store tasks local storage for storage space allocation unit Between;
Argument pointer switch unit is configured in the task switching call back function of operating system with increasing global pointer Location handover operation;
Access unit is configured to the access for completing to store the thread-local variable by the global pointer.
According to the method for the present invention and device, global variable can be converted to the TLS variable of task to realize TLS. Method of the invention does not need processor, compiler provides special support, does not modify original operating system yet, has very high answer Use flexibility ratio.Method of the invention greatly reduces the enforcement difficulty of TLS, extends the application range of TLS.
Other feature or advantage of the invention will illustrate in the following description.Also, Partial Feature of the invention or Advantage will be become apparent by specification, or be appreciated that by implementing the present invention.The purpose of the present invention and part Advantage can be realized or be obtained by step specifically noted in the specification, claims and drawings.
Detailed description of the invention
Attached drawing is used to provide further understanding of the present invention, and constitutes part of specification, with reality of the invention It applies example and is used together to explain the present invention, be not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is method flow diagram according to an embodiment of the invention;
Fig. 2 is system structure schematic diagram according to an embodiment of the invention.
Specific embodiment
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and examples, implementation personnel of the invention whereby Can fully understand that how the invention applies technical means to solve technical problems, and reach technical effect realization process and according to The present invention is embodied according to above-mentioned realization process.As long as each embodiment it should be noted that do not constitute conflict, in the present invention And each feature in each embodiment can be combined with each other, be formed by technical solution protection scope of the present invention it It is interior.
Under prior art environment, realizes the method for TLS or need to expand compiler or need to provide dedicated letter It counts library or processor is needed to do special support.In embedded development field, the method for above-mentioned realization TLS has very big Limitation.
In order to further increase the application flexibility for the method for realizing TLS, the application range of TLS, hair of the invention are extended Bright people analyzes the basic reason for leading to prior art limitation first.
Firstly, will not generally be further added by a thread library in existing operating system when target machine resource is limited;
Secondly, processor used in existing method, operating system and developing instrument are all according to specific task Demand carries out special type selecting, however generally requires to carry out former technology specific to the technology of compiler, processor and operating system Change, is difficult general;
Again, existing method is implemented both for the code newly write, and is difficult the global variable in existing code It is revised as TLS variable.
On the problem of existing global global variable is revised as TLS variable, a kind of common manual way is: will All global variables in source code all become function pointer parameter, are each global variable point before thread carries out function call With space, and argument pointer is transmitted to the position for needing to have used global variable layer by layer by function parameter.This method exists Size of code is less, is a simple and effective method, but the code once used is slightly when function calling relationship is simple Complexity, global variable more than one, the difficulty of conversion and the probability of error are all very big, and pass through all global variable meetings of function passes Greatly deepen storehouse, influences program efficiency (because the pointer needs of global variable are passed up to from the stack frame of top layer function The storehouse bottom.)
Based on above-mentioned analysis, the invention proposes a kind of methods for realizing TLS.Method of the invention is based on embedded more Operating system of being engaged in realizes that primary operational is the TLS variable that global variable is converted to task.In this way, do not need processor, Compiler provides special support, does not also modify on the basis of original operating system is realized and realizes TLS.To overcome the prior art to exist The deficiency in embedded development field.
Specifically, including: by source code by the process that global variable is converted to the TLS variable of task in one embodiment In global variable be revised as global pointer;Thread-local store tasks local space is distributed for global variable;It is operating Increase global pointer address handover operation in the task switching call back function of system.It can finally be completed by global pointer Access to thread-local storage variable.According to above-mentioned steps, it both can increase TLS for fresh code and support, also can be convenient The global variable of existing code is revised as TLS variable, to solve the problems, such as the concurrent of access global variable.
Next based on the specific execution process of one embodiment of attached drawing the present invention is described in detail.It is shown in the flow chart of attached drawing The step of can be executed in the computer system comprising such as a group of computer-executable instructions.Although showing in flow charts The logical order of each step, but in some cases, can be different from sequence herein execute it is shown or described Step.
In an embodiment of the present invention, the global variable in source code is modified first, and the global variable in source program is repaired It is changed to global pointer (step S110).Specifically, the type of all global variables is collected into a total global data structures In body, and generate the global pointer (global_tls_ptr) for being directed toward total global data structures body.
Further, in one embodiment, the definition of global variable is annotated in step s 110, prevents compiler It reallocates when compiling Static-state Space;Further, in one embodiment, it to the access of global variable, is revised as referring to by the overall situation The access of needle prevents compiler from carrying out static binding to the access of global variable.
Next, increasing pointer handover operation (step S120) when initialization.Specifically, by the pointer of the TLS variable space Switching function is articulated in the switching call back function in operating system system.For example, in the common multitask behaviour of built-in field Make to both provide call back function when task switching substantially in system (such as VxWorks, RTEMS, μ C/OS).
Task needs to distribute local storage space (step S130) for thread before calling the function containing global variable. Specifically, calling the creation operation of TLS variable, the local storage space of a global variable is distributed for current thread.Meanwhile it will work as The task identification (ID) of preceding task is tied to the first address of TLS variable local storage space.
Further, during distributing TLS task local storage space, the local storage space position of TLS variable It is to be bound with task, there are 3 kinds of selections: global static zones, task stack, task control block in when realization.Due to task control block In the realization of existing operating system, size is fixed, and not modifying operating system cannot achieve, and task control block is not appropriate for.Cause This is in an embodiment of the present invention mainly using global static array or task stack.
In specifically exploitation environment, the task quantity if necessary to TLS variable just can determine that before operation, then preferentially Static zones are selected, this is a kind of very common situation in embedded development field.If task quantity dynamic change, and task With regard to TLS variable there is no need to by other routine access after exiting, then task stack also can be used.
When operating system carries out task switching, the local storage space (step of thread-local storage variable is searched S140).Specifically, call back function finds the first ground of its corresponding TLS variable local storage space by being cut into the ID of task Global_tls_ptr pointer is given the address assignment in location.Because the use of all global variables is all by the operation of the first step It is to be carried out by pointer, in this way, the conversion of task global variable to local storage space can be completed by switching pointer.
Further, in an embodiment of the present invention, when task switches, the ID by cutting task searches corresponding deposit Space address is stored up, hash is carried out to task ID by a hash function, to improve lookup rate.
At this point, just completing the access (step S150) to TLS variable by the pointer of global variable.It should be noted that Different from the technological means of remaining TLS variable, need to access TLS variable by special API, the present invention is still by complete Office's pointer accesses, and does not need to increase any API, so, even without in multitask environment, making for program will not be influenced With with portable well.
Finally, calling the release operation of TLS variable when task is not when needing using global variable, being distributed before release Local storage space (step S160).
Method according to the invention it is possible to which global variable is converted to the TLS variable of task to realize TLS.The present invention Method do not need processor, compiler provides special support, do not modify original operating system, it is only necessary to which operating system provides yet One task switching call back function interface can be achieved with, seldom to the dependence of compiler, operating system, have very high application spirit Activity.
Method of the invention is not needed using special TLS variables access function in source code, in remaining operating system On also can directly use, greatly reduce the enforcement difficulty of TLS, extend the application range of TLS.Further, according to this hair Bright method, task is when switching TLS variable storage space, it is only necessary to which handover operation can be completed by modifying a pointer, to original Systematic efficiency influences very little.
Based on method of the invention, the invention also provides a kind of, and the realization thread-local based on multiple task operating system is deposited The device of storage.The device of the invention is configured to be converted to global variable the thread-local storage variable of task to realize thread sheet Ground storage.In one embodiment, as shown in Fig. 2, device 200 includes:
Source program modifies unit 220, is configured to the global variable in source code being revised as global pointer;
Storage space allocation unit 240 is configured to global variable distribution thread-local store tasks local space (thread-local store tasks local space is built into local storage space 202);
Argument pointer switch unit 230 is configured to increase in the task switching call back function 201 of operating system global Pointer address handover operation;
Access unit 210 is configured to the access for completing to store thread-local variable by global pointer.
In the process of running, source program modification unit 220 annotates the definition of global variable, prevents compiler from compiling When reallocate Static-state Space;And by the access to global variable, it is revised as the access by global pointer, prevents compiler pair The access of global variable carries out static binding;Meanwhile the type of all global variables is collected into a total global data knot In structure body, and generate the global pointer of a direction global data structures body.
When initialization, argument pointer switch unit 230 mounts the pointer switching function of the thread-local storage variable space Into the switching call back function in operating system system.
In task before calling the function containing global variable, storage space allocation unit 240 calls thread-local storage Variable creation operation, the local storage space for distributing a global variable for current thread (construct in local storage space 202 Thread-local store tasks local space).Meanwhile storage space allocation unit 240 constructs task ID and TLS task is local The concordance list of memory space address.The task identification of current task is tied to thread-local storage variable local storage space First address.
In this way, call back function finds its correspondence by being cut into the mark of task when operating system carries out task switching Thread-local storage variable local storage space first address, by the address assignment give the global pointer.So that visiting Ask that unit 210 can be completed by global pointer (concordance list of task based access control ID and TLS task local storage space address) Access to thread-local storage variable.
Finally, device 200 also includes releasing unit 250.Task is not when needing using global variable, releasing unit 250 Call thread-local storage variable release operation, the local storage space distributed before release.
Process is executed followed by method and device of the specific application example to one embodiment of the invention to do Further description (application example is based on apparatus structure shown in Fig. 2).
A) source program modification unit 220 completes the pretreatment of source code, and global variable is revised as global pointer.
Specifically, for taking 2 global variables in source program:
Global variable is modified by the first step will to generate following code after global pointer:
The definition of global variable id and desc_cr therein is annotated, and newly-generated one includes all global variables The access function of structural body the struct task_tls_space, id and desc_cr of type are replaced by global_tls_ Ptr- > id and global_tls_ptr- > desc_cr.cmd.Due to it is this transformation be it is very regular, in the present invention In one embodiment, it can easily be realized by craft or preprocessor.
TLS global variable pointer can thus be constructed.All global variables all pass through pointer addressing.
As the global pointer in example is exactly:
Struct task_tls_space*global_tls_ptr;
B) storage space allocation unit 240 distributes TLS task local storage space.
In the present embodiment, TLS address of variable space is stored using static array, be accomplished by
Struct task_tls_space task_tls_index[MAX_TASK_SUPPORTED];
Further, in order to distribute TLS task local storage space, storage space allocation unit 240 includes TLS task sheet The application function of ground memory space.Task calls void task_tls_space_ before calling the function containing global variable create(int taskid);Function is the creation operation of TLS variable, distributes being locally stored for a global variable for current thread Space.
Further, in order to which the access for completing to store thread-local variable by global pointer will also construct task ID With the concordance list of TLS task local storage space address.Specifically, in the present embodiment, storing TLS variable using static array Address space is accomplished by
struct task_tls_space task_tls_index[MAX_TASK_SUPPORTED];
C) argument pointer switch unit 230 increases global pointer address handover operation, switches TLS argument pointer.Specific packet It includes:
int task_tls_space_hook_Init(void);
void task_tls_space_swap_hook(int oldtaskid,int newtaskid);
When initialization, argument pointer switch unit 230 is by calling function int task_tls_space_hook_Init (void);The pointer switching function task_tls_space_swap_hook of the TLS variable space is articulated to operating system system In switching call back function in.
D) when operating system carries out task switching,
It calls void task_tls_space_swap_hook (int oldtaskid, int newtaskid);
Search the taskid of will cutting for task in task_tls_index as index by newtaskid, so Global_tls_ptr is assigned a value of to the struct task_tls_space pointer of corresponding position in array afterwards.
In this way, access unit 200 can complete the access for storing variable to thread-local by global pointer.
E) finally, releasing unit 250 includes the release function of TLS task local storage space.Specifically, in the present embodiment In, when not using local storage space, releasing unit 250 is called
void task_tls_space_destroy(int taskid);
The memory space of function destruction TLS variable.
Further, this technology can both be used in and newly write in code, can also be used in existing code, allow to prop up Hold TLS variable storage.If method of the invention is applied and is converting existing code to the code for supporting TLS, need source Global variable in code is converted to global pointer.In an embodiment of the present invention, realizing has 2 kinds of selections: hand when code conversion Work conversion and code pretreatment.
If size of code and global variable are all fewer, can easily just complete to turn using character string search/replacement by hand It changes.
If size of code and global variable are mostly relatively more, a code preprocessor is used.Code preprocessor is realized It should because only needing to identify the definition and access of the global variable in C code for a simple C language syntax analyzer Than one complete C syntax analyzer of preprocessor is simply more.Main to realize that step is: scanning source code finds the overall situation Variable then collects the definition structure of global variable if it is the definition statement of variable, and it is anti-to comment out existing global variable definition Only compiler is global variable storage allocation;Sentence is used if it is global variable, then is revised as the access structure of variable The access result of one global pointer.It is last to be defined according to all global variables being collected into, generate a total global data Structural body comprising the global variable definition in institute's source code, and generates the overall situation for being directed toward the global data structures body and refers to Needle.This pointer is exactly that task switching is the unique data needed according to the task modification being cut into.
Further, in an embodiment of the present invention, when global variable being converted to global pointer, there are 2 kinds of selections:
First is that using a global pointer for each global variable.In this way when accessing global variable, by corresponding complete Office's pointer, which once jump, can find address of variable.But each global pointer is necessary for when task switching and is assigned a value of again The TLS address of variable of new task, can reduce task switching time.So if global variable is few, task switches infrequently switching Time requirement is not harsh, and this method can be used.
Second is that using a global pointer for all global variables.In this way when accessing global variable, by corresponding complete Office's pointer, which once jump, can find address of variable.But it only needs to assign again for this global pointer when task switching Value is the first address of the TLS variable local storage space of new task.If task switching is frequently, switching time requires severe It carves, this method can be used.In many embedded-development environments, this selection is more desirable.
To sum up, according to the method for the present invention and device, global variable can be converted to the TLS variable of task to realize TLS.Method of the invention does not need processor, compiler provides special support, does not modify original operating system yet, has very high Degree flexible in application.Method of the invention greatly reduces the enforcement difficulty of TLS, extends the application range of TLS.
While it is disclosed that embodiment content as above but described only to facilitate understanding the present invention and adopting Embodiment is not intended to limit the invention.Method of the present invention can also have other various embodiments.Without departing substantially from In the case where essence of the present invention, those skilled in the art make various corresponding changes or change in accordance with the present invention Shape, but these corresponding changes or deformation all should belong to scope of protection of the claims of the invention.

Claims (10)

1. a kind of method for realizing thread-local storage, which is characterized in that deposit the thread-local that global variable is converted to task Storage variable is to realize that thread-local stores, comprising:
The global variable in source code is revised as global pointer;
Increase global pointer address handover operation in the task switching call back function of operating system;
Thread-local store tasks local space is distributed for the global variable;
The access that variable is stored to the thread-local is completed by the global pointer.
2. the method according to claim 1, wherein global variable is revised as global pointer, wherein will own The type of global variable is collected into a total global data structures body, and is generated one and be directed toward the global data structures body Global pointer.
3. according to the method described in claim 2, preventing compiler it is characterized in that, the definition to global variable annotates It reallocates when compiling Static-state Space.
4. according to the method in claim 2 or 3, which is characterized in that by the access to global variable, be revised as passing through the overall situation The access of pointer prevents compiler from carrying out static binding to the access of global variable.
5. the method according to claim 1, wherein increasing institute in the task switching call back function of operating system State global pointer address handover operation, in which:
When initialization, the pointer switching function of the thread-local storage variable space is articulated to switching back into operating system system In letter of transfer number.
6. according to the method described in claim 5, it is characterized in that, distributing thread-local store tasks office for the global variable Portion's memory space, in which:
The task calls thread-local storage variable creation operation, before calling the function containing global variable to work as front The local storage space of a global variable of journey distribution.
7. according to the method described in claim 6, being deposited it is characterized in that, the task identification of current task is tied to thread-local Store up the first address of variable local storage space.
8. the method according to the description of claim 7 is characterized in that being completed by the global pointer to the thread-local Store the access of variable, in which:
When operating system carries out task switching, call back function finds its corresponding thread-local by being cut into the mark of task The first address for storing variable local storage space gives the address assignment to the global pointer.
9. the method according to claim 1, wherein the task when not needing using global variable, is called Thread-local stores variable release operation, the local storage space distributed before release.
10. a kind of device for realizing thread-local storage, which is characterized in that described device, which is configured to be converted to global variable, appoints To realize that thread-local stores, described device includes: the thread-local storage variable of business
Source program modifies unit, is configured to the global variable in source code being revised as global pointer;
Storage space allocation unit is configured to the global variable distribution thread-local store tasks local space;
Argument pointer switch unit is configured to the increase global pointer address in the task switching call back function of operating system and cuts Change operation;
Access unit is configured to the access for completing to store the thread-local variable by the global pointer.
CN201610806319.2A 2016-09-06 2016-09-06 A kind of method and device for realizing thread-local storage Active CN106445656B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610806319.2A CN106445656B (en) 2016-09-06 2016-09-06 A kind of method and device for realizing thread-local storage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610806319.2A CN106445656B (en) 2016-09-06 2016-09-06 A kind of method and device for realizing thread-local storage

Publications (2)

Publication Number Publication Date
CN106445656A CN106445656A (en) 2017-02-22
CN106445656B true CN106445656B (en) 2019-10-11

Family

ID=58165122

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610806319.2A Active CN106445656B (en) 2016-09-06 2016-09-06 A kind of method and device for realizing thread-local storage

Country Status (1)

Country Link
CN (1) CN106445656B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106445656B (en) * 2016-09-06 2019-10-11 北京邮电大学 A kind of method and device for realizing thread-local storage
CN107741883B (en) * 2017-09-29 2018-10-23 武汉斗鱼网络科技有限公司 A kind of method, apparatus and computer equipment avoiding thread block
CN109240702B (en) * 2018-08-15 2022-06-14 无锡江南计算技术研究所 Fast segment addressing configuration and access method in multi-thread mode
CN113076556A (en) * 2021-03-29 2021-07-06 北京中电华大电子设计有限责任公司 eUICC signed data file management method
CN116483545B (en) * 2023-06-19 2023-09-29 支付宝(杭州)信息技术有限公司 Multitasking execution method, device and equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1983191A (en) * 2005-12-12 2007-06-20 中兴通讯股份有限公司 Method for setting up scheduling restricted zone in built-in realtime system by global variable
CN101937367A (en) * 2009-06-30 2011-01-05 英特尔公司 The MPI source code program arrives the automatic conversion based on the program of MPI thread
CN103116522A (en) * 2013-01-31 2013-05-22 广州海格通信集团股份有限公司 Kernel dynamic switching method and control system of digital signal processing (DSP) chip
CN104216767A (en) * 2014-09-18 2014-12-17 东软集团股份有限公司 Method and device for accessing shared data among multiple threads
CN104778138A (en) * 2015-04-20 2015-07-15 中国科学院光电技术研究所 Kernel multithreading direct-access drive implementation method
CN105786525A (en) * 2016-03-23 2016-07-20 鼎点视讯科技有限公司 Method and device for transplanting code from process model to thread model
CN106445656A (en) * 2016-09-06 2017-02-22 北京邮电大学 Method and device for realizing thread local storage

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1983191A (en) * 2005-12-12 2007-06-20 中兴通讯股份有限公司 Method for setting up scheduling restricted zone in built-in realtime system by global variable
CN101937367A (en) * 2009-06-30 2011-01-05 英特尔公司 The MPI source code program arrives the automatic conversion based on the program of MPI thread
CN103116522A (en) * 2013-01-31 2013-05-22 广州海格通信集团股份有限公司 Kernel dynamic switching method and control system of digital signal processing (DSP) chip
CN104216767A (en) * 2014-09-18 2014-12-17 东软集团股份有限公司 Method and device for accessing shared data among multiple threads
CN104778138A (en) * 2015-04-20 2015-07-15 中国科学院光电技术研究所 Kernel multithreading direct-access drive implementation method
CN105786525A (en) * 2016-03-23 2016-07-20 鼎点视讯科技有限公司 Method and device for transplanting code from process model to thread model
CN106445656A (en) * 2016-09-06 2017-02-22 北京邮电大学 Method and device for realizing thread local storage

Also Published As

Publication number Publication date
CN106445656A (en) 2017-02-22

Similar Documents

Publication Publication Date Title
CN106445656B (en) A kind of method and device for realizing thread-local storage
US6460126B1 (en) Computer resource management system
US10620988B2 (en) Distributed computing architecture
US20060026183A1 (en) Method and system provide concurrent access to a software object
US7356655B2 (en) Methods, systems, and media for managing dynamic storage
US8453132B2 (en) System and method for recompiling code based on locality domain and thread affinity in NUMA computer systems
US20060095483A1 (en) Modified computer architecture with finalization of objects
EP0428084A2 (en) Method and apparatus for compiling computer programs with interprocedural register allocation
US20050283785A1 (en) Preemptive multi-tasking with cooperative groups of tasks
JPH02188833A (en) Interface for computer system
US8601456B2 (en) Software transactional protection of managed pointers
JP5980916B2 (en) Computer-implemented method and computer system
EP1763772A1 (en) Modified computer architecture with initialization of objects
KR19980086685A (en) How to run an object remotely
US9501285B2 (en) Register allocation to threads
US7788661B2 (en) Method and system for applying patches to a computer program concurrently with its execution
JP2004220583A (en) Method and system for executing global processor resource assignment in assembler
EP2321734B1 (en) Type descriptor management for frozen objects
US6959430B2 (en) Specialized heaps for creation of objects in object-oriented environments
US8387009B2 (en) Pointer renaming in workqueuing execution model
CN111344667B (en) System and method for compiling and executing code within virtual memory sub-pages of one or more virtual memory pages
US10496433B2 (en) Modification of context saving functions
US6499094B1 (en) Management of memory heap space for data files accessible to programs operating in different addressing modes
JPH06243112A (en) Multiprocessor device
US6275985B1 (en) Method and apparatus for developing an application that implements garbage collection efficiently by combining proxy objects with compiler support

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant