Journal "Software Engineering"
a journal on theoretical and applied science and technology
ISSN 2220-3397

Issue N4 2019 year

DOI: 10.17587/prin.10.178-185
Using Thread Local Memory for Calculating B-Splines in Parallel Programming Tasks
P. M. Nikolaev, geom3d@gmail.com, Central Aerohydrodynamic Institute, Zhukovsky, 140181, Russian Federation
Corresponding author: Nikolaev Prokopiy M., Head of Department, Central Aerohydrodynamic Institute, 140181, Zhukovsky, Russian Federation, E-mail: geom3d@gmail.com
Received on November 29, 2018
Accepted on December 06, 2018

One of the main remaining problems in the multi-threaded programs development is the organization of asynchronous data access from different threads. The usage of locking objects is the standard method of synchronizing data access from different threads. Ensuring sequential access to shared data, locks reduces the degree of parallelism and decreases the overall performance of parallel algorithms. To reduce the number of locks, it is preferable to use a separate copy of the data for each running thread. The article discusses the method of dynamic allocation of memory associated with a specific thread. Thus, each executed thread has its own copy of the data and the need for synchronization disappears. The discussed method is implemented in the form of a C++ class that ensures the storage of a pointer to the memory local to the current thread and subsequent access to it. Pointers to the allocated memory are stored in an associative array. The access key is the identifier of the current thread. At the thread termination it is required to free the allocated memory associated with this thread. Based on the use of C++ threadlocal qualifier, a special mechanism has been developed for freeing the memory associated with the thread when it is completed. An example of using the developed class in calculating the values of B-splines in a multithreaded environment is given. It is shown that the use of standard synchronization methods (stack variables, critical sections) when using auxiliary arrays in the B-spline calculation algorithm has significant overheads. The use of the developed method reduces the need for synchronization objects and improves the performance of calculating B-splines in multi-threaded programs.

Keywords: parallel programming, multithreaded execution, asynchronous data access, local thread storage, B-spline
pp. 178–185
For citation:
Nikolaev P. M. Using Thread Local Memory for Calculating B-Splines in Parallel Programming Tasks, Programmnaya Ingeneria, 2019, vol. 10, no. 4, pp. 178—185.