並行執行 (Concurrent Execution)
*******************************

本章節描述的模組在程式的並行執行上提供支援。選擇要使用哪一個工具則取決
於是執行什麼樣的任務（CPU 密集或 IO 密集）與偏好的開發風格（事件驅動協
作式多工處理或搶占式多工處理）。以下為此章節總覽：

* "threading" --- 基於執行緒的平行性

  * Thread-Local Data

  * Thread Objects

  * Lock Objects

  * RLock 物件

  * Condition Objects

  * Semaphore Objects

    * "Semaphore" 範例

  * Event Objects

  * Timer Objects

  * Barrier Objects

  * Using locks, conditions, and semaphores in the "with" statement

* "multiprocessing" --- 以行程為基礎的平行性

  * 簡介

    * "Process" 類別

    * Contexts and start methods

    * Exchanging objects between processes

    * Synchronization between processes

    * Sharing state between processes

    * Using a pool of workers

  * Reference

    * "Process" 與例外

    * Pipes and Queues

    * Miscellaneous

    * Connection Objects

    * Synchronization primitives

    * 共享的 "ctypes" 物件

      * "multiprocessing.sharedctypes" 模組

    * Managers

      * Customized managers

      * Using a remote manager

    * Proxy Objects

      * Cleanup

    * Process Pools

    * Listeners and Clients

      * Address Formats

    * Authentication keys

    * Logging

    * "multiprocessing.dummy" 模組

  * Programming guidelines

    * All start methods

    * The *spawn* and *forkserver* start methods

  * 範例

* "multiprocessing.shared_memory" --- 對於共享記憶體的跨行程直接存取

* "concurrent" 套件

* "concurrent.futures" --- 啟動平行任務

  * Executor 物件

  * ThreadPoolExecutor

    * ThreadPoolExecutor 範例

  * ProcessPoolExecutor

    * ProcessPoolExecutor 範例

  * Future 物件

  * 模組函式

  * 例外類別

* "subprocess" --- 子行程管理

  * Using the "subprocess" Module

    * Frequently Used Arguments

    * Popen Constructor

    * 例外

  * 安全性注意事項

  * Popen Objects

  * Windows Popen Helpers

    * Windows Constants

  * Older high-level API

  * Replacing Older Functions with the "subprocess" Module

    * Replacing **/bin/sh** shell command substitution

    * Replacing shell pipeline

    * Replacing "os.system()"

    * Replacing the "os.spawn" family

    * Replacing "os.popen()", "os.popen2()", "os.popen3()"

    * Replacing functions from the "popen2" module

  * Legacy Shell Invocation Functions

  * 註解

    * Converting an argument sequence to a string on Windows

    * 停用 "vfork()" 或 "posix_spawn()"

* "sched" --- 事件排程器

  * 排程器物件

* "queue" --- 同步佇列 (synchronized queue) 類別

  * 佇列物件

    * Terminating queues

  * SimpleQueue 物件

* "contextvars" --- 情境變數

  * Context Variables

  * Manual Context Management

  * asyncio support

以下是支援部份上述服務的模組：

* "_thread" --- 低階執行緒 API
