<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article article-type="research-article" dtd-version="1.3" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="ru"><front><journal-meta><journal-id journal-id-type="publisher-id">ntv</journal-id><journal-title-group><journal-title xml:lang="ru">Научно-технический вестник информационных технологий, механики и оптики</journal-title><trans-title-group xml:lang="en"><trans-title>Scientific and Technical Journal of Information Technologies, Mechanics and Optics</trans-title></trans-title-group></journal-title-group><issn pub-type="ppub">2226-1494</issn><issn pub-type="epub">2500-0373</issn><publisher><publisher-name>Университет ИТМО</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.17586/2226-1494-2026-26-1-125-134</article-id><article-id custom-type="elpub" pub-id-type="custom">ntv-571</article-id><article-categories><subj-group subj-group-type="heading"><subject>Research Article</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="ru"><subject>КОМПЬЮТЕРНЫЕ СИСТЕМЫ И ИНФОРМАЦИОННЫЕ ТЕХНОЛОГИИ</subject></subj-group><subj-group subj-group-type="section-heading" xml:lang="en"><subject>COMPUTER SCIENCE</subject></subj-group></article-categories><title-group><article-title>Оценка производительности алгоритмов синхронизации в средах исполнения с легкими потоками на языке С++</article-title><trans-title-group xml:lang="en"><trans-title>Performance evaluation of synchronization algorithms in lightweight thread environments in C++</trans-title></trans-title-group></title-group><contrib-group><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0009-0002-1959-2010</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Скаженик</surname><given-names>Т. М.</given-names></name><name name-style="western" xml:lang="en"><surname>Skazhenik</surname><given-names>T. M.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Скаженик Тарас Михайлович — аспирант</p><p>Санкт-Петербург, 197101</p></bio><bio xml:lang="en"><p>Taras M. Skazhenik — PhD Student</p><p>Saint Petersburg, 197101</p></bio><email xlink:type="simple">taras.skazhenik@yandex.ru</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-9134-5490</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Аксенов</surname><given-names>В. Е.</given-names></name><name name-style="western" xml:lang="en"><surname>Aksenov</surname><given-names>V. E.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Аксенов Виталий Евгеньевич — PhD, доцент</p><p>Санкт-Петербург, 197101</p><p>sc 57195411657</p></bio><bio xml:lang="en"><p>Vitaly E. Aksenov — PhD, Associate Professor</p><p>Saint Petersburg, 197101</p><p>sc 57195411657</p></bio><email xlink:type="simple">aksenov.vitaly@gmail.com</email><xref ref-type="aff" rid="aff-1"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0009-0004-9276-2172</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Малахов</surname><given-names>А. А.</given-names></name><name name-style="western" xml:lang="en"><surname>Malakhov</surname><given-names>A. A.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Малахов Антон Александрович — научный сотрудник</p><p>Нижний Новгород, 603138</p></bio><bio xml:lang="en"><p>Anton A. Malakhov — Scientific Researcher</p><p>Nizhny Novgorod, 603138</p></bio><email xlink:type="simple">Anton.A.Malakhov@gmail.com</email><xref ref-type="aff" rid="aff-2"/></contrib><contrib contrib-type="author" corresp="yes"><contrib-id contrib-id-type="orcid">https://orcid.org/0009-0009-3165-4932</contrib-id><name-alternatives><name name-style="eastern" xml:lang="ru"><surname>Чурбанов</surname><given-names>А. В.</given-names></name><name name-style="western" xml:lang="en"><surname>Churbanov</surname><given-names>A. V.</given-names></name></name-alternatives><bio xml:lang="ru"><p>Чурбанов Андрей Васильевич — независимый исследователь</p></bio><bio xml:lang="en"><p>Andrey V. Churbanov — Independent Researcher</p></bio><email xlink:type="simple">andrey.churbanov@gmail.com</email></contrib></contrib-group><aff-alternatives id="aff-1"><aff xml:lang="ru"><institution>Университет ИТМО</institution><country>Россия</country></aff><aff xml:lang="en"><institution>ITMO University</institution><country>Russian Federation</country></aff></aff-alternatives><aff-alternatives id="aff-2"><aff xml:lang="ru"><institution>Университет Неймарк</institution><country>Россия</country></aff><aff xml:lang="en"><institution>Neimark University</institution><country>Russian Federation</country></aff></aff-alternatives><pub-date pub-type="collection"><year>2026</year></pub-date><pub-date pub-type="epub"><day>25</day><month>02</month><year>2026</year></pub-date><volume>26</volume><issue>1</issue><fpage>125</fpage><lpage>134</lpage><permissions><copyright-statement>Copyright &amp;#x00A9; Скаженик Т.М., Аксенов В.Е., Малахов А.А., Чурбанов А.В., 2026</copyright-statement><copyright-year>2026</copyright-year><copyright-holder xml:lang="ru">Скаженик Т.М., Аксенов В.Е., Малахов А.А., Чурбанов А.В.</copyright-holder><copyright-holder xml:lang="en">Skazhenik T.M., Aksenov V.E., Malakhov A.A., Churbanov A.V.</copyright-holder><license xml:lang="ru" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>Данная работа распространяется под лицензией Creative Commons Attribution 4.0.</license-p></license><license xml:lang="en" license-type="creative-commons-attribution" xlink:href="https://creativecommons.org/licenses/by/4.0/" xlink:type="simple"><license-p>This work is licensed under a Creative Commons Attribution 4.0 License.</license-p></license></permissions><self-uri xlink:href="https://ntv.elpub.ru/jour/article/view/571">https://ntv.elpub.ru/jour/article/view/571</self-uri><abstract><p>Введение. Традиционно, многопоточные структуры данных разрабатывались и тестировались для вызовов из потоков операционной системы. Однако в последнее время в языках программирования появилась альтернатива — легкие потоки (иначе известные, как асинхронные вызовы, и корутины). Такие потоки бывают двух видов со стеком и без него. В настоящей работе рассмотрены стековые корутины. Основное преимущество легких потоков заключается в меньшем количестве накладных расходов. В отличие от потоков операционной системы, в стандартной библиотеке языка С++ отсутствует реализация стековых легких потоков. Они предоставляются несколькими библиотеками, отличающимися: планированием исполнения потока, способом хранения данных в памяти и интерфейсом использования. Кроме того, переиспользование существующего кода невозможно из-за необходимости явной разметки кода точками переключения контекста, отсутствие которых может приводить к взаимной блокировке легких потоков. Для ограничения области исследования рассмотрен конкретный вид многопоточных примитивов — мьютекс (иначе известный, как взаимное исключение). Метод. Выполнен анализ нескольких библиотек для работы с легкими потоками: Argobots, Boost Fibers, Userver. На основе оценки их функциональности, разработан трехступенчатый механизм ожидания, использующий активное ожидание, переключение контекста, а также способы приостановки и возобновления легкого потока. Описание механизма включает предложение об общем способе его внедрения в известные алгоритмы мьютексов. Механизм служит дополнительным слоем абстракции между библиотеками легких потоков и мьютексами, позволяя реализовывать их в общем виде. Из-за отсутствия существующих решений, был создан инструмент для тестирования и оценки производительности модифицированных мьютексов. Основные результаты. С помощью предложенного метода ряд известных мьютексов был адаптирован для вызовов из легких потоков. Для тестирования получившихся примитивов разработан инструмент, позволяющий интегрировать произвольные реализации легких потоков и учитывающий специфику работы с ними. В результате была измерена пропускная способность адаптированных мьютексов с помощью нового инструмента на специальном сценарии, отражающем особенности кооперативной многозадачности. Обсуждение. В перспективе планируется формирование библиотеки, включающей все известные реализации мьютексов, адаптированных под вызовы из легких потоков. Это позволит провести детальное сравнение производительности этих алгоритмов в зависимости от: библиотеки легких потоков, алгоритмов планировщика и архитектуры процессора. Ожидается, что детальный анализ поведения существующих алгоритмов позволит создать новую реализацию мьютекса, работающего наиболее эффективно на вызовах из легких потоков.</p></abstract><trans-abstract xml:lang="en"><p>Traditionally, multithreaded data structures have been designed and tested for use with Operating System (OS) threads. However, in recent years, programming languages have introduced an alternative — lightweight threads (also known as asynchronous calls or coroutines). These threads can be divided into two types: stackful and stackless; this paper focuses on stackful coroutines. The main advantage of lightweight threads lies in their reduced overhead. Unlike OS threads, the C++ Standard Library lacks a native implementation of stackful lightweight threads. They are instead provided by several third-party libraries which differ in scheduling policies, memory management approaches, and interfaces. Moreover, reusing existing code is often infeasible due to the explicit marking of context-switching points required by coroutines, their absence may lead to deadlocks between lightweight threads. To narrow the research scope, this work focuses on a specific synchronization primitive — the mutex (mutual exclusion). Several lightweight threading libraries were examined, including Argobots, Boost Fibers, and Userver. Based on an analysis of their functionality, a three-phase waiting mechanism was developed that combines active spinning, context switching, and coroutine suspension and resumption techniques. The description of the mechanism includes a general approach for integrating it into existing mutex algorithms. This mechanism acts as an additional abstraction layer between lightweight threading libraries and mutex implementations, enabling a unified design. Due to the absence of existing solutions, a dedicated tool was developed for testing and performance evaluation of the modified mutexes. Using the proposed method, several well-known mutexes were adapted for the usage from lightweight threads. To test these primitives, a tool was created that allows integration with arbitrary coroutine implementations and accounts for their specific execution models. The throughput of the adapted mutexes was measured using this tool under a specialized workload scenario, reflecting the characteristics of cooperative multitasking. In future work, the aim is to develop a comprehensive library encompassing all known mutex implementations adapted for lightweight thread environments. This will enable detailed performance comparisons across coroutine libraries, scheduling algorithms, and processor architectures. It is expected that a thorough analysis of existing algorithms behavior will lead to the development of a new mutex design optimized for lightweight thread execution.</p></trans-abstract><kwd-group xml:lang="ru"><kwd>методы синхронизации</kwd><kwd>мьютекс</kwd><kwd>легкие потоки</kwd><kwd>оценка производительности</kwd><kwd>NUMA-архитектура</kwd><kwd>C++</kwd></kwd-group><kwd-group xml:lang="en"><kwd>synchronization methods</kwd><kwd>mutex</kwd><kwd>lightweight threads</kwd><kwd>performance evaluation</kwd><kwd>NUMA architecture</kwd><kwd>C++</kwd></kwd-group></article-meta></front><back><ref-list><title>References</title><ref id="cit1"><label>1</label><citation-alternatives><mixed-citation xml:lang="ru">Moore G.E. Cramming more components onto integrated circuits // Electronics. 1965. V. 38. N 8. P. 114–117.</mixed-citation><mixed-citation xml:lang="en">Moore G.E. Cramming more components onto integrated circuits // Electronics. 1965. V. 38. N 8. P. 114–117.</mixed-citation></citation-alternatives></ref><ref id="cit2"><label>2</label><citation-alternatives><mixed-citation xml:lang="ru">Sutter H. The free lunch is over: a fundamental turn toward concurrency in software // Dr. Dobb’s Journal. 2005. V. 30. N 3. P. 202–210.</mixed-citation><mixed-citation xml:lang="en">Sutter H. The free lunch is over: a fundamental turn toward concurrency in software // Dr. Dobb’s Journal. 2005. V. 30. N 3. P. 202–210.</mixed-citation></citation-alternatives></ref><ref id="cit3"><label>3</label><citation-alternatives><mixed-citation xml:lang="ru">Olukotun O.A., Hammond L., Laudon J.P. Chip Multiprocessor Architecture: Techniques to Improve Throughput and Latency. Morgan &amp; Claypool Publishers, 2007. 145 p.</mixed-citation><mixed-citation xml:lang="en">Olukotun O.A., Hammond L., Laudon J.P. Chip Multiprocessor Architecture: Techniques to Improve Throughput and Latency. Morgan &amp; Claypool Publishers, 2007. 145 p.</mixed-citation></citation-alternatives></ref><ref id="cit4"><label>4</label><citation-alternatives><mixed-citation xml:lang="ru">Lameter C. NUMA (Non-Uniform Memory Access): An Overview: NUMA becomes more common because memory controllers get close to execution units on microprocessors // Queue. 2013. V. 11. N 7. P. 40–51. https://doi.org/10.1145/2508834.2513149</mixed-citation><mixed-citation xml:lang="en">Lameter C. NUMA (Non-Uniform Memory Access): An Overview: NUMA becomes more common because memory controllers get close to execution units on microprocessors // Queue. 2013. V. 11. N 7. P. 40–51. https://doi.org/10.1145/2508834.2513149</mixed-citation></citation-alternatives></ref><ref id="cit5"><label>5</label><citation-alternatives><mixed-citation xml:lang="ru">Seo S., Amer A., Balaji P., Bordage C., Bosilca G., Brooks A., et al. Argobots: a lightweight low-level threading and tasking framework // IEEE Transactions on Parallel and Distributed Systems. 2018. V. 29. N 3. P. 512–526. https://doi.org/10.1109/tpds.2017.2766062</mixed-citation><mixed-citation xml:lang="en">Seo S., Amer A., Balaji P., Bordage C., Bosilca G., Brooks A., et al. Argobots: a lightweight low-level threading and tasking framework // IEEE Transactions on Parallel and Distributed Systems. 2018. V. 29. N 3. P. 512–526. https://doi.org/10.1109/tpds.2017.2766062</mixed-citation></citation-alternatives></ref><ref id="cit6"><label>6</label><citation-alternatives><mixed-citation xml:lang="ru">Castello A., Gual R.M., Seo S., Balaji P., Quintana-Orti E.S., Pena A.J. Analysis of threading libraries for high performance computing // IEEE Transactions on Computers. 2020. V. 69. N 9. P. 1279–1292. https://doi.org/10.1109/tc.2020.2970706</mixed-citation><mixed-citation xml:lang="en">Castello A., Gual R.M., Seo S., Balaji P., Quintana-Orti E.S., Pena A.J. Analysis of threading libraries for high performance computing // IEEE Transactions on Computers. 2020. V. 69. N 9. P. 1279–1292. https://doi.org/10.1109/tc.2020.2970706</mixed-citation></citation-alternatives></ref><ref id="cit7"><label>7</label><citation-alternatives><mixed-citation xml:lang="ru">Tanenbaum A.S., Bos H. Modern Operating Systems. ‎ Pearson, 2014. 1136 p.</mixed-citation><mixed-citation xml:lang="en">Tanenbaum A.S., Bos H. Modern Operating Systems. ‎ Pearson, 2014. 1136 p.</mixed-citation></citation-alternatives></ref><ref id="cit8"><label>8</label><citation-alternatives><mixed-citation xml:lang="ru">Rudolph L., Segall Z. Dynamic decentralized cache schemes for mimd parallel processors // ACM SIGARCH Computer Architecture News. 1984. V. 12. N 3 . P. 340–347. https://doi.org/10.1145/773453.808203</mixed-citation><mixed-citation xml:lang="en">Rudolph L., Segall Z. Dynamic decentralized cache schemes for mimd parallel processors // ACM SIGARCH Computer Architecture News. 1984. V. 12. N 3 . P. 340–347. https://doi.org/10.1145/773453.808203</mixed-citation></citation-alternatives></ref><ref id="cit9"><label>9</label><citation-alternatives><mixed-citation xml:lang="ru">Mellor-Crummey J.M., Scott M.L. Algorithms for scalable synchronization on shared-memory multiprocessors // ACM Transactions on Computer Systems. 1991. V. 9. N 1. P. 21–65. https://doi.org/10.1145/103727.103729</mixed-citation><mixed-citation xml:lang="en">Mellor-Crummey J.M., Scott M.L. Algorithms for scalable synchronization on shared-memory multiprocessors // ACM Transactions on Computer Systems. 1991. V. 9. N 1. P. 21–65. https://doi.org/10.1145/103727.103729</mixed-citation></citation-alternatives></ref><ref id="cit10"><label>10</label><citation-alternatives><mixed-citation xml:lang="ru">Craig T.S. Building FIFO and Priorityqueuing Spin Locks from Atomic Swap. Technical Report TR 93-02-02. Department of Computer Science, University of Washington, 1993. 29 p.</mixed-citation><mixed-citation xml:lang="en">Craig T.S. Building FIFO and Priorityqueuing Spin Locks from Atomic Swap. Technical Report TR 93-02-02. Department of Computer Science, University of Washington, 1993. 29 p.</mixed-citation></citation-alternatives></ref><ref id="cit11"><label>11</label><citation-alternatives><mixed-citation xml:lang="ru">Chabbi M., Fagan M., Mellor-Crummey J. High performance locks for multi-level NUMA systems // ACM SIGPLAN Notices. 2015. V. 50. N 8. P. 215–226. https://doi.org/10.1145/2858788.2688503</mixed-citation><mixed-citation xml:lang="en">Chabbi M., Fagan M., Mellor-Crummey J. High performance locks for multi-level NUMA systems // ACM SIGPLAN Notices. 2015. V. 50. N 8. P. 215–226. https://doi.org/10.1145/2858788.2688503</mixed-citation></citation-alternatives></ref><ref id="cit12"><label>12</label><citation-alternatives><mixed-citation xml:lang="ru">Dice D., Kogan A. Compact NUMA-aware locks // Proc. of the 14th EuroSys Conference. 2019. P. 1–15. https://doi.org/10.1145/3302424.3303984</mixed-citation><mixed-citation xml:lang="en">Dice D., Kogan A. Compact NUMA-aware locks // Proc. of the 14th EuroSys Conference. 2019. P. 1–15. https://doi.org/10.1145/3302424.3303984</mixed-citation></citation-alternatives></ref><ref id="cit13"><label>13</label><citation-alternatives><mixed-citation xml:lang="ru">Shanley T. x86 Instruction Set Architecture. MindShare Press, 2010. 1568 p.</mixed-citation><mixed-citation xml:lang="en">Shanley T. x86 Instruction Set Architecture. MindShare Press, 2010. 1568 p.</mixed-citation></citation-alternatives></ref><ref id="cit14"><label>14</label><citation-alternatives><mixed-citation xml:lang="ru">Oberhauser J., Oberhauser L., Paolillo A., Behrens D., Fu M., Vafeiadis V. Verifying and optimizing the HMCS lock for Arm servers // Lecture Notes in Computer Science. 2021. V. 12754. P. 240–260. https://doi.org/10.1007/978-3-030-91014-3_17</mixed-citation><mixed-citation xml:lang="en">Oberhauser J., Oberhauser L., Paolillo A., Behrens D., Fu M., Vafeiadis V. Verifying and optimizing the HMCS lock for Arm servers // Lecture Notes in Computer Science. 2021. V. 12754. P. 240–260. https://doi.org/10.1007/978-3-030-91014-3_17</mixed-citation></citation-alternatives></ref><ref id="cit15"><label>15</label><citation-alternatives><mixed-citation xml:lang="ru">Goodacre J., Sloss A.N. Parallelism and the ARM instruction set architecture // Computer. 2005. V. 38. N 7. P. 42–50. https://doi.org/10.1109/mc.2005.239</mixed-citation><mixed-citation xml:lang="en">Goodacre J., Sloss A.N. Parallelism and the ARM instruction set architecture // Computer. 2005. V. 38. N 7. P. 42–50. https://doi.org/10.1109/mc.2005.239</mixed-citation></citation-alternatives></ref><ref id="cit16"><label>16</label><citation-alternatives><mixed-citation xml:lang="ru">Bartel J. Non-preemptive multitasking // The Computer Journal. 1988. V. 30. P. 37–39.</mixed-citation><mixed-citation xml:lang="en">Bartel J. Non-preemptive multitasking // The Computer Journal. 1988. V. 30. P. 37–39.</mixed-citation></citation-alternatives></ref><ref id="cit17"><label>17</label><citation-alternatives><mixed-citation xml:lang="ru">Karsten M., Barghi S. User-level threading: Have your cake and eat it too // Proc. of the ACM on Measurement and Analysis of Computing Systems. 2020. V. 4. N 1. P. 1–30. https://doi.org/10.1145/3379483</mixed-citation><mixed-citation xml:lang="en">Karsten M., Barghi S. User-level threading: Have your cake and eat it too // Proc. of the ACM on Measurement and Analysis of Computing Systems. 2020. V. 4. N 1. P. 1–30. https://doi.org/10.1145/3379483</mixed-citation></citation-alternatives></ref><ref id="cit18"><label>18</label><citation-alternatives><mixed-citation xml:lang="ru">Madsen O.L. Using coroutines for multi-core preemptive scheduling // Proc. of the 11th Workshop on Programming Languages and Operating Systems. 2021. P. 46–52. https://doi.org/10.1145/3477113.3487271</mixed-citation><mixed-citation xml:lang="en">Madsen O.L. Using coroutines for multi-core preemptive scheduling // Proc. of the 11th Workshop on Programming Languages and Operating Systems. 2021. P. 46–52. https://doi.org/10.1145/3477113.3487271</mixed-citation></citation-alternatives></ref><ref id="cit19"><label>19</label><citation-alternatives><mixed-citation xml:lang="ru">Shiina S., Iwasaki S., Taura K., Balaji P. Lightweight preemptive user-level threads // Proc. of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. 2021. P. 374–388. https://doi.org/10.1145/3437801.3441610</mixed-citation><mixed-citation xml:lang="en">Shiina S., Iwasaki S., Taura K., Balaji P. Lightweight preemptive user-level threads // Proc. of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. 2021. P. 374–388. https://doi.org/10.1145/3437801.3441610</mixed-citation></citation-alternatives></ref><ref id="cit20"><label>20</label><citation-alternatives><mixed-citation xml:lang="ru">Donovan A.A., Kernighan B.W. The Go Programming Language. Addison-Wesley Professional, 2015. 400 p.</mixed-citation><mixed-citation xml:lang="en">Donovan A.A., Kernighan B.W. The Go Programming Language. Addison-Wesley Professional, 2015. 400 p.</mixed-citation></citation-alternatives></ref></ref-list><fn-group><fn fn-type="conflict"><p>The authors declare that there are no conflicts of interest present.</p></fn></fn-group></back></article>
