A Tag-Based Solution for Safer Parallel STL Usage

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

A Tag-Based Solution for Safer Parallel STL Usage

Číslo: 2/2023
Periodikum: Acta Electrotechnica et Informatica
DOI: 10.2478/aei-2023-0008

Pro získání musíte mít účet v Citace PRO.

Přečíst po přihlášení

Anotace: 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.