Browse > Article
http://dx.doi.org/10.7583/JKGS.2021.21.1.55

Implementation of Lock-Free shared_ptr and weak_ptr for C++11 multi-thread programming  

Ku, TaeKyun (Dept. of Game Engineering, Korea Polytechnic Univ.)
Jung, NaiHoon (Dept. of Game & Multimedia Engineering, Korea Polytechnic Univ.)
Abstract
Multi-thread programming is essential in high performance game programming. But, the widely used C++11 shared_ptr and weak_ptr have malfunction and performance problems in multi-thread environments. In this paper, we propose Lock-Free shared_ptr and weak_ptr, which have higher performance than current error preventing methods. These use a non-blocking algorithm to prevent data race in multi-thread environments. As a result of experimenting in an 8 thread environment, performance has improved up to 7424% in a situation where competition between threads is low, and 3767% in high competition.
Keywords
Lock-Free; C++11 shared_ptr; C++11 weak_ptr; Data race;
Citations & Related Records
연도 인용수 순위
  • Reference
1 S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson. "Eraser: A dynamic data race detector for multithreaded programs", ACM Transactions on Computer Systems, 15(4):391-411, 1997.   DOI
2 M. Michael, "Hazard pointers: Safe memory reclamation for lock-free objects", IEEE Transactions on Parallel and Distributed Systems, 15 (6): 491-504. 2004.   DOI
3 H. Wen, J. Izraelevitz, W. Cai, H. A. Beadle and M. L. Scott. "Interval-based memory reclamation". ACM SIGPLAN Notices. 2018.
4 Trevor Alexander Brown, "Reclaiming Memory for lock-free Data Structures: There has to be a Better Way", PODC '15: Proceedings of the 2015 ACM Symposium on Principles of Distributed Computing, July 2015, https://doi.org/10.1145/2767386.2767436   DOI
5 M. Herlihy and N. Shavit. "The Art of Multiprocessor Programming Revised Reprint", Morgan Kaufmann, 2012.
6 M. Herlihy. "Wait-Free Synchronization". ACM Transactions on Programming anguages and Systems (TOPLAS), 13 (1): 124-149, Jan. 1991.
7 D. Dechev, P. Pirkelbauer and B. Stroustrup. "Understanding and Effectively Preventing the ABA Problem in Descriptor-based Lock-free Designs". 13th IEEE International Symposium on Object/Component/Service-Oriented Real-Time Distributed Computing, 2010.
8 Bjarne Stroustrup, "The C++ Programming Language (Fourth Edition)", Addison-Wesley, pp. 990-995, 2013
9 Steam Hardware&Software Survey: July 2020, https://store.steampowered.com/hwsurvey/cpus/
10 INCITS/ISO/IEC, "Information technology-Programming-C++", New York: American National Standards Institute, INCITS/ISO/IEC 14882-2011[2012], pp. 540-565, 2012.