Наука, Научные статьи

ВИРТУАЛЬНЫЕ ПОТОКИ – ЭВОЛЮЦИЯ ПАРАЛЛЕЛЬНОГО ПРОГРАММИРОВАНИЯ В ЯЗЫКЕ JAVA

Том 4 № 8 (2021): Научно-образовательный журнал преподавателей и студентов «StudNet»

УДК 004.4’2

Вялков Кирилл Андреевич, Аспирант, федеральное государственное автономное образовательное учреждение высшего образования «Национальный исследовательский университет ИТМО», Россия, г. Санкт-Петербург. E-mail: akvone@mail.ru

Vyalkov Kirill Andreevich, Postgraduate student, Saint Petersburg National Research University of Information Technologies, Mechanics and Optics Russia, Saint-Petersburg. E-mail: akvone@mail.ru

Аннотация

Исторически сложилось, что написание параллельного кода является намного более сложным процессом, чем написание обычного последовательного кода. Для написания параллельных приложений на языке Java с самых ранних версий использовались потоки. Но со временем довольно сложные программы стали еще сложнее из-за того, что для обеспечения максимальной производительности пришлось применять подходы, которые позволили оптимизировать повторное использование потоков при этом сильно снизив удобство написания и читаемость кода. Появившийся в 2018 году проект Loom поставил своей задачей дать возможность разработчикам Java перестать использовать данные подходы, упростить разработку и при этом писать масштабируемый код. Для реализации этой задачи в Java Development Kit была добавлена концепция виртуальных потоков, более известных в научной литературе как файберы.

В данной работе будет описана проблема, с которой столкнулись разработчики Java, рассмотрена текущая система абстракций параллельного программирования платформы и нововведения проекта Loom. В финальной части работы будет приведена апробация работы ранних сборок Java Development Kit, а также рассмотрены текущие ограничения архитектуры.

Annotation

Historically, writing concurrent programs has been much more complex than writing the sequential ones. Java language has threads from the very beginning to build concurrent applications. But over time, fairly complex programs have become even more complex since to maximize performance it was necessary to use approaches that allowed to reuse the threads which in turn led to a decrease in code maintainability and readability. Launched in 2018, the Loom project has the goal to make Java developers stop using these approaches, simplify development, and still write scalable code at the same time. To accomplish this task, the Java Development Kit has added the concept of virtual threads, which is known in the scientific literature as fibers.

This paper describes the problem faced by the developers, the current system of concurrent abstractions of the Java platform, and the innovations of the Loom project. In the final part of the work, we test the early builds of the Java Development Kit and describe the current limitations of the architecture that should be considered.

Ключевые слова: поток, виртуальный поток, файбер, планировщик задач, Java, проект Loom, схема M:N.

Key words: Thread, virtual thread, fiber, task scheduler, Java, project Loom, M:N schema

Литература

  1. http://mail.openjdk.java.net/pipermail/loom-dev
  2. https://wiki.openjdk.java.net/display/loom/Main
  3. http://cr.openjdk.java.net/~rpressler/loom/Loom-Proposal.html
  4. https://dl.acm.org/doi/fullHtml/10.1145/3416315.3416320
  5. State of Loom https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.html
  6. State of Loom: Part 2 https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part2.html
  7. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.50.4682&rep=rep1&type=pdf
  8. https://www.researchgate.net/publication/270217184_Thread_models_Semantics_Solaris_and_Linux_MN_to_11_thread_model

Literature

  1. The loom-dev Archives http://mail.openjdk.java.net/pipermail/loom-dev
  2. Project Loom Wiki https://wiki.openjdk.java.net/display/loom/Main
  3. Project Loom: Fibers and Continuations for the Java Virtual Machine http://cr.openjdk.java.net/~rpressler/loom/Loom-Proposal.html
  4. Fibers are not (P) Threads: The Case for Loose Coupling of Asynchronous Programming Models and MPI Through Continuations https://dl.acm.org/doi/fullHtml/10.1145/3416315.3416320
  5. State of Loom https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.html
  6. State of Loom: Part 2 https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part2.html
  7. Runtime Performance Analysis of the M-to-N Scheduling Model http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.50.4682&rep=rep1&type=pdf
  8. Thread models Semantics: Solaris and Linux M: N to 1: 1 thread model https://www.researchgate.net/publication/270217184_Thread_models_Semantics_Solaris_and_Linux_MN_to_11_thread_model

You Might Also Like