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

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

* "threading" --- Thread-based parallelism

  * 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-based parallelism

  * 簡介

    * The "Process" class

    * 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

    * Shared "ctypes" Objects

      * The "multiprocessing.sharedctypes" module

    * Managers

      * Customized managers

      * Using a remote manager

    * Proxy Objects

      * Cleanup

    * Process Pools

    * Listeners and Clients

      * Address Formats

    * Authentication keys

    * Logging

    * The "multiprocessing.dummy" module

  * Programming guidelines

    * All start methods

    * The *spawn* and *forkserver* start methods

  * 範例

* "multiprocessing.shared_memory" --- Shared memory for direct access
  across processes

* The "concurrent" package

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

  * Executor 物件

  * ThreadPoolExecutor

    * ThreadPoolExecutor 範例

  * ProcessPoolExecutor

    * ProcessPoolExecutor 範例

  * Future 物件

  * 模組函式

  * 例外類別

* "subprocess" --- Subprocess management

  * Using the "subprocess" Module

    * Frequently Used Arguments

    * Popen Constructor

    * 例外

  * Security Considerations

  * 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

    * Disabling use of "vfork()" or "posix_spawn()"

* "sched" --- Event scheduler

  * Scheduler Objects

* "queue" --- 同步佇列 (queue) class（類別）

  * 佇列物件

  * SimpleQueue 物件

* "contextvars" --- Context Variables

  * Context Variables

  * Manual Context Management

  * asyncio support

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

* "_thread" --- Low-level threading API
