Модифікація алгоритму пулу потоків з багатьма чергами

dc.citation.epage102
dc.citation.issue1
dc.citation.journalTitleКомп'ютерні системи та мережі
dc.citation.spage96
dc.citation.volume5
dc.contributor.affiliationНаціональний університет “Львівська політехніка”
dc.contributor.affiliationLviv Polytechnic National University
dc.contributor.authorПуйда, Д. В.
dc.contributor.authorPuida, D.
dc.coverage.placenameЛьвів
dc.coverage.placenameLviv
dc.date.accessioned2025-07-23T09:11:01Z
dc.date.created2023-02-28
dc.date.issued2023-02-28
dc.description.abstractНаведено модифікацію алгоритму пулу потоків, який запропонував Шон Парент на конференції NDC London 2017. Запропонований алгоритм не поступається оригінальному алгоритму за швидкодією та простотою реалізації, і водночас усуває потенційний недолік оригінального алгоритму, який полягає у тому, що за певних обставин кілька задач можуть виконуватися на тому самому потоці, тоді як інші потоки – перебувати в стані очікування задачі. Основна ідея, яка запропонована в роботі, полягає у відстеженні сумарної кількості задач, які містяться в чергах пулу потоків. Коли головний потік поміщає нову задачу в якусь із черг, лічильник кількості задач збільшується на одиницю. Коли задача вилучається з черги, лічильник кількості задач зменшується на одиницю. У випадку, коли потік пулу хоче отримати задачу, він переглядає черги доти, доки йому не вдасться отримати задачу з якоїсь із черг або доки лічильник кількості задач не дорівнюватиме нулю. Якщо лічильник кількості задач дорівнює нулеві, потік переходить у стан сну до моменту, коли лічильник кількості потоків не стане знову ненульовим. Тоді один із потоків пулу прокидається і починає перевіряти черги на наявність задач. Дуже важливо зберегти рівномірний розподіл задач по чергах, оскільки це істотно впливає на швидкодію програми.
dc.description.abstractIn this paper, the author suggests a modification of the thread pool algorithm that was presented by Sean Parent at NDC London 2017. The suggested algorithm is as simple as the original implementation and demonstrates similar performance, while eliminating a potential drawback of the original implementation consisting in the fact that under certain circumstances, multiple tasks can be executed on the same thread, while other threads may be waiting for a task. The suggested idea consists in tracking the total number of tasks that are in the queues of the thread pool. When the main thread pushes a new task to one of the queues, the tasks counter is incremented. When a task is removed from the queue, the task counter is decremented. When a thread wants to get a task, it keeps checking the queues until it succeeds in getting a task from one of the queues, or until the tasks counter becomes equal to zero. When the tasks counter becomes equal to zero, the thread becomes idle until the counter becomes non-zero again. Then, one of the threads wakes up and starts checking the queues. An important point is to maintain even distribution of tasks in the queues since it has a significant impact on the performance of the algorithm.
dc.format.extent96-102
dc.format.pages7
dc.identifier.citationПуйда Д. В. Модифікація алгоритму пулу потоків з багатьма чергами / Д. В. Пуйда // Комп'ютерні системи та мережі. — Львів : Видавництво Львівської політехніки, 2023. — Том 5. — № 1. — С. 96–102.
dc.identifier.citationenPuida D. Modification of a thread pool algorithm with multiple task queues / D. Puida // Computer Systems and Networks. — Lviv : Lviv Politechnic Publishing House, 2023. — Vol 5. — No 1. — P. 96–102.
dc.identifier.doidoi.org/10.23939/csn2023.01.096
dc.identifier.urihttps://ena.lpnu.ua/handle/ntb/111627
dc.language.isouk
dc.publisherВидавництво Львівської політехніки
dc.publisherLviv Politechnic Publishing House
dc.relation.ispartofКомп'ютерні системи та мережі, 1 (5), 2023
dc.relation.ispartofComputer Systems and Networks, 1 (5), 2023
dc.relation.references1. Amdahl G. The validity of the single processor approach to achieving large-scale computing capabilities, Proceedings of AFIPS Spring Joint Computer Conference, Atlantic City, N. J., AFIPS Press, 483-485.
dc.relation.references2. ISO International Standard ISO/IEC 14882:2020(E). Programming Language C++.
dc.relation.references3. David Chase and Yossi Lev, Dynamic circular work-stealing deque, SPAA, 21–28. ACM, 2005. DOI: 10.1145/1073970.1073974.
dc.relation.references4. K. Agrawal et al. Executing task graphs using work-stealing, IEEE IPDPS, April 2010, 1–12. DOI: 10.1109/IPDPS.2010.5470403.
dc.relation.references5. Nhat Minh Lé et al., Correct and efficient work-stealing for weak memory models, PPoPP, 69–80. ACM, 2013. DOI: 10.1145/2442516.2442524.
dc.relation.references6. T. Huang et al., Cpp-Taskflow: Fast task-based parallel programming using modern C++. In IEEE IPDPS, May 2019, 974–983. DOI: 10.1109/IPDPS.2019.00105.
dc.relation.references7. C.-X. Lin, T.-W. Huang and M. D. F. Wong, An Efficient Work-Stealing Scheduler for Task Dependency Graph, 2020 IEEE 26th International Conference on Parallel and Distributed Systems (ICPADS), Hong Kong, 2020, 64–71. DOI: 10.1109/ICPADS51040.2020.00018.
dc.relation.references8. Intel oneAPI Threading Building Blocks. URL: https://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html
dc.relation.references9. Sean Parent, Better Code: Concurrency, NDC { London } 2017. URL: https://seanparent.stlab.cc/presentations/2016-08-08-concurrency/2016-08-08-concurrency.pdf
dc.relation.references10. Thread Pool Benchmark. URL: https://github.com/Red-Portal/thread-pool-benchmark/
dc.relation.referencesen1. Amdahl G. The validity of the single processor approach to achieving large-scale computing capabilities, Proceedings of AFIPS Spring Joint Computer Conference, Atlantic City, N. J., AFIPS Press, 483-485.
dc.relation.referencesen2. ISO International Standard ISO/IEC 14882:2020(E). Programming Language C++.
dc.relation.referencesen3. David Chase and Yossi Lev, Dynamic circular work-stealing deque, SPAA, 21–28. ACM, 2005. DOI: 10.1145/1073970.1073974.
dc.relation.referencesen4. K. Agrawal et al. Executing task graphs using work-stealing, IEEE IPDPS, April 2010, 1–12. DOI: 10.1109/IPDPS.2010.5470403.
dc.relation.referencesen5. Nhat Minh Lé et al., Correct and efficient work-stealing for weak memory models, PPoPP, 69–80. ACM, 2013. DOI: 10.1145/2442516.2442524.
dc.relation.referencesen6. T. Huang et al., Cpp-Taskflow: Fast task-based parallel programming using modern C++. In IEEE IPDPS, May 2019, 974–983. DOI: 10.1109/IPDPS.2019.00105.
dc.relation.referencesen7. C.-X. Lin, T.-W. Huang and M. D. F. Wong, An Efficient Work-Stealing Scheduler for Task Dependency Graph, 2020 IEEE 26th International Conference on Parallel and Distributed Systems (ICPADS), Hong Kong, 2020, 64–71. DOI: 10.1109/ICPADS51040.2020.00018.
dc.relation.referencesen8. Intel oneAPI Threading Building Blocks. URL: https://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html
dc.relation.referencesen9. Sean Parent, Better Code: Concurrency, NDC { London } 2017. URL: https://seanparent.stlab.cc/presentations/2016-08-08-concurrency/2016-08-08-concurrency.pdf
dc.relation.referencesen10. Thread Pool Benchmark. URL: https://github.com/Red-Portal/thread-pool-benchmark/
dc.relation.urihttps://www.intel.com/content/www/us/en/developer/tools/oneapi/onetbb.html
dc.relation.urihttps://seanparent.stlab.cc/presentations/2016-08-08-concurrency/2016-08-08-concurrency.pdf
dc.relation.urihttps://github.com/Red-Portal/thread-pool-benchmark/
dc.rights.holder© Національний університет “Львівська політехніка”, 2023
dc.rights.holder© Пуйда Д. В., 2023
dc.subjectбагатопотоковість
dc.subjectпул потоків
dc.subjectперехоплення задач
dc.subjectmultithreading
dc.subjectthread pool
dc.subjecttask stealing
dc.subject.udc004.825
dc.titleМодифікація алгоритму пулу потоків з багатьма чергами
dc.title.alternativeModification of a thread pool algorithm with multiple task queues
dc.typeArticle

Files

Original bundle

Now showing 1 - 2 of 2
Loading...
Thumbnail Image
Name:
2023v5n1_Puida_D-Modification_of_a_thread_pool_96-102.pdf
Size:
5.05 MB
Format:
Adobe Portable Document Format
Loading...
Thumbnail Image
Name:
2023v5n1_Puida_D-Modification_of_a_thread_pool_96-102__COVER.png
Size:
415.26 KB
Format:
Portable Network Graphics

License bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
license.txt
Size:
1.76 KB
Format:
Plain Text
Description: