Research on the efficiency of parallelization of processor-dependent tasks in Python based on the thread mechanism

Authors

DOI:

https://doi.org/10.31558/2786-9482.2024.1.2

Keywords:

processor-dependent tasks, speed of data processing, parallelization, thread mechanism, the Python language

Abstract

The objective of the paper is to study the effectiveness of using parallel data processing based on threads in the Python language to solve problems that require significant CPU resources. The task of processing a two-dimensional array of large sizes using standard Python tools without using specialized libraries such as Numpy was considered as such a problem. As a result of the research, an unexpected decrease in the execution time of the multi-threaded program by 30% was found in comparison with the sequential (non-parallel) implementation of the problem being solved. This makes it possible to question the well-known statement that multi-threaded solving of processor-dependent tasks in the Python language is not effective, as it does not lead to a decrease in the running time of programs. Previously, it was believed that due to the use of the so-called global lock (GIL), the Python language interpreter, when executing multithreaded programs using Threading module, directs all program threads to one processor core, which excludes the physical parallel execution of threads and under no circumstances allows to reduce time of program execution. A well-known recommendation for obtaining a real gain in time is the use of parallelization based on the process mechanism and the "multiprocessing" module, which allows several physical processor cores to be used. However, this approach requires additional processor resources (cores) and additional time spent on data exchange between processes, which can nullify the effect of multi-core processing. The experiments conducted by the authors proved that the use of a multithreaded approach can also be appropriate in the case of processor-dependent tasks, since the time gain achieved does not require additional resources from the computer's central processor and unnecessary time spent on data exchange between threads.

References

Качко, О. Г. (2016). Паралельне програмування. Харків: Харківський національний університет радіоелектроніки.

Мельник, А. О., Яковлєва, І. Д. (2018). Структурний аналіз і синтез паралельних алгоритмів. Чернівці: Чернівецький національний університет.

Семеренко, В. П. (2018). Технології паралельних обчислень. Вінниця: Вінницький національний технічний університет.

Burns, B. (2018). Designing Distributed Systems. Patterns and Paradigms for Scalable, Reliable Services. Sebastopol: O’Reilly Media.

Lutz, M. (2013). Learning Python, 5th Edition. Sebastopol: O’Reilly Media.

A Guide to Python Multiprocessing and Parallel Programming (2022). https://www.sitepoint.com/python-multiprocessing-parallel-programming/

Parallel Processing in Python (2019). https://www.geeksforgeeks.org/parallel-processing-in-python/

Published

2024-10-10

How to Cite

[1]
Бабаков, Р. and Баркалов, О. 2024. Research on the efficiency of parallelization of processor-dependent tasks in Python based on the thread mechanism. Ukrainian Journal of Information Systems and Data Science. 1 (Oct. 2024), 15–26. DOI:https://doi.org/10.31558/2786-9482.2024.1.2.