Dokumen ini untuk versi lama Python yang tidak didukung lagi. Anda harus memutakhirkan, dan membaca Dokumentasi Python untuk rilis stabil saat ini.

# Eksekusi Serentak

Modul yang dijelaskan dalam bab ini memberikan dukungan untuk eksekusi kode secara bersamaan. Pilihan alat yang tepat akan tergantung pada tugas yang akan dijalankan (CPU terikat vs IO terikat) dan gaya yang dipilih saat pembuatan (multitasking koperatif yang dipicu kejadian vs multitasking preemptif). Berikut ini ikhtisar:

- `threading` --- Thread-based parallelism
  - Thread-Local Data
  - Thread Objects
  - Lock Objects
  - RLock Objects
  - Condition Objects
  - Semaphore Objects
    - `Semaphore` Example
  - Event Objects
  - Timer Objects
  - Barrier Objects
  - Using locks, conditions, and semaphores in the `with` statement
- `multiprocessing` --- Process-based parallelism
  - Pengenalan
    - The `Process` class
    - Contexts and start methods
    - Exchanging objects between processes
    - Synchronization between processes
    - Sharing state between processes
    - Using a pool of workers
  - Referensi
    - `Process` and exceptions
    - Pipes and Queues
    - Miscellaneous
    - Objek Koneksi
    - 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
    - Pencatatan Logging
    - The `multiprocessing.dummy` module
  - Programming guidelines
    - All start methods
    - The spawn and forkserver start methods
  - Contoh-contoh
- `multiprocessing.shared_memory` --- Provides shared memory for direct access across processes
- Paket `concurrent`
- `concurrent.futures` --- Launching parallel tasks
  - Executor Objects
  - ThreadPoolExecutor
    - ThreadPoolExecutor Example
  - ProcessPoolExecutor
    - ProcessPoolExecutor Example
  - Future Objects
  - Module Functions
  - Exception classes
- `subprocess` --- Subprocess management
  - Using the `subprocess` Module
    - Frequently Used Arguments
    - Popen Constructor
    - Pengecualian
  - 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
  - Catatan
    - Converting an argument sequence to a string on Windows
- `sched` --- Event scheduler
  - Scheduler Objects
- `queue` --- A synchronized queue class
  - Queue Objects
  - SimpleQueue Objects
- `contextvars` --- Context Variables
  - Context Variables
  - Manual Context Management
  - asyncio support

Berikut ini adalah modul pendukung untuk beberapa layanan di atas:

- `_thread` --- Low-level threading API