concurrency.md
1> **Источник:** https://python-all.ru/3.13/library/concurrency.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Параллельное выполнение89Модули, описанные в этой главе, обеспечивают поддержку параллельного выполнения кода. Выбор подходящего инструмента зависит от выполняемой задачи (с привязкой к ЦП или к вводу-выводу) и предпочитаемого стиля разработки (событийно-ориентированная кооперативная многозадачность или вытесняющая многозадачность). Ниже приведён обзор:1011- [`threading` – параллелизм на основе потоков](https://python-all.ru/3.13/library/threading.html)1213 - [Введение](https://python-all.ru/3.13/library/threading.html#introduction)14 - [GIL и соображения производительности](https://python-all.ru/3.13/library/threading.html#gil-and-performance-considerations)15 - [Справочник](https://python-all.ru/3.13/library/threading.html#reference)1617 - [Данные, локальные для потока](https://python-all.ru/3.13/library/threading.html#thread-local-data)18 - [Объекты потоков](https://python-all.ru/3.13/library/threading.html#thread-objects)19 - [Объекты блокировок](https://python-all.ru/3.13/library/threading.html#lock-objects)20 - [Объекты RLock](https://python-all.ru/3.13/library/threading.html#rlock-objects)21 - [Объекты условия](https://python-all.ru/3.13/library/threading.html#condition-objects)22 - [Объекты семафоров](https://python-all.ru/3.13/library/threading.html#semaphore-objects)23 - [Пример `Semaphore`](https://python-all.ru/3.13/library/threading.html#semaphore-example)24 - [Объекты событий](https://python-all.ru/3.13/library/threading.html#event-objects)25 - [Объекты таймеров](https://python-all.ru/3.13/library/threading.html#timer-objects)26 - [Объекты барьеров](https://python-all.ru/3.13/library/threading.html#barrier-objects)27 - [Использование блокировок, условий и семафоров в операторе `with`](https://python-all.ru/3.13/library/threading.html#using-locks-conditions-and-semaphores-in-the-with-statement)28- [`multiprocessing` – параллелизм на основе процессов](https://python-all.ru/3.13/library/multiprocessing.html)2930 - [Введение](https://python-all.ru/3.13/library/multiprocessing.html#introduction)3132 - [Класс `Process`](https://python-all.ru/3.13/library/multiprocessing.html#the-process-class)33 - [Контексты и методы запуска](https://python-all.ru/3.13/library/multiprocessing.html#contexts-and-start-methods)34 - [Обмен объектами между процессами](https://python-all.ru/3.13/library/multiprocessing.html#exchanging-objects-between-processes)35 - [Синхронизация между процессами](https://python-all.ru/3.13/library/multiprocessing.html#synchronization-between-processes)36 - [Совместное использование состояния между процессами](https://python-all.ru/3.13/library/multiprocessing.html#sharing-state-between-processes)37 - [Использование пула рабочих процессов](https://python-all.ru/3.13/library/multiprocessing.html#using-a-pool-of-workers)38 - [Справочник](https://python-all.ru/3.13/library/multiprocessing.html#reference)3940 - [Глобальный метод запуска](https://python-all.ru/3.13/library/multiprocessing.html#global-start-method)41 - [`Process` и исключения](https://python-all.ru/3.13/library/multiprocessing.html#process-and-exceptions)42 - [Каналы и очереди](https://python-all.ru/3.13/library/multiprocessing.html#pipes-and-queues)43 - [Разное](https://python-all.ru/3.13/library/multiprocessing.html#miscellaneous)44 - [Объекты соединений](https://python-all.ru/3.13/library/multiprocessing.html#connection-objects)45 - [Примитивы синхронизации](https://python-all.ru/3.13/library/multiprocessing.html#synchronization-primitives)46 - [Разделяемые `ctypes` объекты](https://python-all.ru/3.13/library/multiprocessing.html#shared-ctypes-objects)4748 - [Модуль `multiprocessing.sharedctypes`](https://python-all.ru/3.13/library/multiprocessing.html#module-multiprocessing.sharedctypes)49 - [Менеджеры](https://python-all.ru/3.13/library/multiprocessing.html#managers)5051 - [Настраиваемые менеджеры](https://python-all.ru/3.13/library/multiprocessing.html#customized-managers)52 - [Использование удалённого менеджера](https://python-all.ru/3.13/library/multiprocessing.html#using-a-remote-manager)53 - [Объекты-прокси](https://python-all.ru/3.13/library/multiprocessing.html#proxy-objects)5455 - [Очистка](https://python-all.ru/3.13/library/multiprocessing.html#cleanup)56 - [Пулы процессов](https://python-all.ru/3.13/library/multiprocessing.html#module-multiprocessing.pool)57 - [Слушатели и клиенты](https://python-all.ru/3.13/library/multiprocessing.html#module-multiprocessing.connection)5859 - [Форматы адресов](https://python-all.ru/3.13/library/multiprocessing.html#address-formats)60 - [Ключи аутентификации](https://python-all.ru/3.13/library/multiprocessing.html#authentication-keys)61 - [Логирование](https://python-all.ru/3.13/library/multiprocessing.html#logging)62 - [Модуль `multiprocessing.dummy`](https://python-all.ru/3.13/library/multiprocessing.html#module-multiprocessing.dummy)63 - [Рекомендации по программированию](https://python-all.ru/3.13/library/multiprocessing.html#programming-guidelines)6465 - [Все методы запуска](https://python-all.ru/3.13/library/multiprocessing.html#all-start-methods)66 - [Методы запуска *spawn* и *forkserver*](https://python-all.ru/3.13/library/multiprocessing.html#the-spawn-and-forkserver-start-methods)67 - [Примеры](https://python-all.ru/3.13/library/multiprocessing.html#examples)68- [`multiprocessing.shared_memory` – Разделяемая память для прямого доступа между процессами](https://python-all.ru/3.13/library/multiprocessing.shared_memory.html)69- [Пакет `concurrent`](https://python-all.ru/3.13/library/concurrent.html)70- [`concurrent.futures` – Запуск параллельных задач](https://python-all.ru/3.13/library/concurrent.futures.html)7172 - [Объекты исполнителя](https://python-all.ru/3.13/library/concurrent.futures.html#executor-objects)73 - [ThreadPoolExecutor](https://python-all.ru/3.13/library/concurrent.futures.html#threadpoolexecutor)7475 - [Пример ThreadPoolExecutor](https://python-all.ru/3.13/library/concurrent.futures.html#threadpoolexecutor-example)76 - [ProcessPoolExecutor](https://python-all.ru/3.13/library/concurrent.futures.html#processpoolexecutor)7778 - [Пример ProcessPoolExecutor](https://python-all.ru/3.13/library/concurrent.futures.html#processpoolexecutor-example)79 - [Объекты Future](https://python-all.ru/3.13/library/concurrent.futures.html#future-objects)80 - [Функции модуля](https://python-all.ru/3.13/library/concurrent.futures.html#module-functions)81 - [Классы исключений](https://python-all.ru/3.13/library/concurrent.futures.html#exception-classes)82- [`subprocess` – Управление подпроцессами](https://python-all.ru/3.13/library/subprocess.html)8384 - [Использование модуля `subprocess`](https://python-all.ru/3.13/library/subprocess.html#using-the-subprocess-module)8586 - [Часто используемые аргументы](https://python-all.ru/3.13/library/subprocess.html#frequently-used-arguments)87 - [Конструктор Popen](https://python-all.ru/3.13/library/subprocess.html#popen-constructor)88 - [Исключения](https://python-all.ru/3.13/library/subprocess.html#exceptions)89 - [Вопросы безопасности](https://python-all.ru/3.13/library/subprocess.html#security-considerations)90 - [Объекты Popen](https://python-all.ru/3.13/library/subprocess.html#popen-objects)91 - [Вспомогательные функции Popen для Windows](https://python-all.ru/3.13/library/subprocess.html#windows-popen-helpers)9293 - [Константы Windows](https://python-all.ru/3.13/library/subprocess.html#windows-constants)94 - [Старый высокоуровневый API](https://python-all.ru/3.13/library/subprocess.html#older-high-level-api)95 - [Замена старых функций модулем `subprocess`](https://python-all.ru/3.13/library/subprocess.html#replacing-older-functions-with-the-subprocess-module)9697 - [Замена подстановки команд оболочки **/bin/sh**](https://python-all.ru/3.13/library/subprocess.html#replacing-bin-sh-shell-command-substitution)98 - [Замена конвейера оболочки](https://python-all.ru/3.13/library/subprocess.html#replacing-shell-pipeline)99 - [Замена `os.system()`](https://python-all.ru/3.13/library/subprocess.html#replacing-os-system)100 - [Замена семейства `os.spawn`](https://python-all.ru/3.13/library/subprocess.html#replacing-the-os-spawn-family)101 - [Замена `os.popen()`, `os.popen2()`, `os.popen3()`](https://python-all.ru/3.13/library/subprocess.html#replacing-os-popen-os-popen2-os-popen3)102 - [Замена функций из модуля `popen2`](https://python-all.ru/3.13/library/subprocess.html#replacing-functions-from-the-popen2-module)103 - [Устаревшие функции вызова оболочки](https://python-all.ru/3.13/library/subprocess.html#legacy-shell-invocation-functions)104 - [Примечания](https://python-all.ru/3.13/library/subprocess.html#notes)105106 - [Поведение при тайм-ауте](https://python-all.ru/3.13/library/subprocess.html#timeout-behavior)107 - [Преобразование последовательности аргументов в строку на Windows](https://python-all.ru/3.13/library/subprocess.html#converting-an-argument-sequence-to-a-string-on-windows)108 - [Отключение использования `vfork()` или `posix_spawn()`](https://python-all.ru/3.13/library/subprocess.html#disabling-use-of-vfork-or-posix-spawn)109- [`sched` – планировщик событий](https://python-all.ru/3.13/library/sched.html)110111 - [Объекты планировщика](https://python-all.ru/3.13/library/sched.html#scheduler-objects)112- [`queue` – класс синхронизированной очереди](https://python-all.ru/3.13/library/queue.html)113114 - [Объекты очередей](https://python-all.ru/3.13/library/queue.html#queue-objects)115116 - [Ожидание завершения задачи](https://python-all.ru/3.13/library/queue.html#waiting-for-task-completion)117 - [Завершение очередей](https://python-all.ru/3.13/library/queue.html#terminating-queues)118 - [Объекты SimpleQueue](https://python-all.ru/3.13/library/queue.html#simplequeue-objects)119- [`contextvars` – контекстные переменные](https://python-all.ru/3.13/library/contextvars.html)120121 - [Контекстные переменные](https://python-all.ru/3.13/library/contextvars.html#context-variables)122 - [Ручное управление контекстом](https://python-all.ru/3.13/library/contextvars.html#manual-context-management)123 - [Поддержка asyncio](https://python-all.ru/3.13/library/contextvars.html#asyncio-support)124125Ниже приведены вспомогательные модули для некоторых из перечисленных выше служб:126127- [`_thread` – низкоуровневый API потоков](https://python-all.ru/3.13/library/_thread.html)128