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 parallelismactive_count()
current_thread()
excepthook()
__excepthook__
get_ident()
get_native_id()
enumerate()
main_thread()
settrace()
settrace_all_threads()
gettrace()
setprofile()
setprofile_all_threads()
getprofile()
stack_size()
TIMEOUT_MAX
- Thread-Local Data
- Thread Objects
- Lock Objects
- RLock Objects
- Condition Objects
- Semaphore Objects
- Event Objects
- Timer Objects
- Barrier Objects
- Using locks, conditions, and semaphores in the
with
statement
multiprocessing
--- Process-based parallelism- Pengenalan
- Referensi
- Programming guidelines
- Contoh-contoh
multiprocessing.shared_memory
--- Shared memory for direct access across processes- The
concurrent
package concurrent.futures
--- Launching parallel taskssubprocess
--- Subprocess management- Using the
subprocess
Module - Security Considerations
- Popen Objects
- Windows Popen Helpers
STARTUPINFO
- Windows Constants
STD_INPUT_HANDLE
STD_OUTPUT_HANDLE
STD_ERROR_HANDLE
SW_HIDE
STARTF_USESTDHANDLES
STARTF_USESHOWWINDOW
STARTF_FORCEONFEEDBACK
STARTF_FORCEOFFFEEDBACK
CREATE_NEW_CONSOLE
CREATE_NEW_PROCESS_GROUP
ABOVE_NORMAL_PRIORITY_CLASS
BELOW_NORMAL_PRIORITY_CLASS
HIGH_PRIORITY_CLASS
IDLE_PRIORITY_CLASS
NORMAL_PRIORITY_CLASS
REALTIME_PRIORITY_CLASS
CREATE_NO_WINDOW
DETACHED_PROCESS
CREATE_DEFAULT_ERROR_MODE
CREATE_BREAKAWAY_FROM_JOB
- Older high-level API
- Replacing Older Functions with the
subprocess
Module - Legacy Shell Invocation Functions
- Catatan
- Using the
sched
--- Event schedulerqueue
--- A synchronized queue classcontextvars
--- Context Variables
Berikut ini adalah modul pendukung untuk beberapa layanan di atas: