Acta Electrotechnica et Informatica (Jun 2023)

A Tag-Based Solution for Safer Parallel STL Usage

  • Barth Benjámin,
  • Szalay Richárd,
  • Porkoláb Zoltán

DOI
https://doi.org/10.2478/aei-2023-0008
Journal volume & issue
Vol. 23, no. 2
pp. 19 – 27

Abstract

Read online

The continuous evolution of programming languages creates a challenge not only for the compiler implementers but also for the regular developers. The C++17 standard introduced the Parallel STL library, a parallel extension of the original and fundamental Standard Template Library (STL) with the promise to achieve safe, efficient, and scalable parallel programming in an easy way. While the syntax remained familiar, the new parallel algorithms introduced additional requirements, which are often ignored even by experienced programmers. In this paper, we investigate the root cause of the misuse of the Parallel STL. We carried out a classroom experiment to measure the programmers’ behaviour when programming using the Parallel STL and found that the major issue is not that their code would be erroneous, but the lack of awareness of the semantic requirements of parallel functors. While a fully automatic detection of erroneous constructs is computationally infeasible to achieve, we introduce a framework with which the developer will be able to indicate – axiomatically, based on absolute trust – that an operation has “safe” properties required by the algorithms. We implemented a prototype of the proposed framework to demonstrate its usability and effectiveness.

Keywords