Thread module: Partial Bottom
Threading module: High-level, provides synchronization mechanism such as lock
Inherit threading. Thread
Run () method/target = function_name
Join (): suspends the current thread until the called thread ends
Start (): Starts the thread, executes the code in run
Threading.current_thread (): Thread number of the currently running thread
Synchronization mechanism:
Threading. Lock (exclusive lock, exclusive lock)
Threading. Rlock (can be re-entered lock, the same thread can be obtained multiple times)
Threading. Semaphone (semaphore, shared lock, number of shares)
Init_value: Number of shares
Threading.condition (provides a wait mechanism to implement a wait queue)
Wait
Notify, Notify_all
Acquire (): Request a lock
Release (): Releasing the lock
Multiprocessing Module
Multiple Python processes = multiple Gil locks
Inherit multiprocessing. Process
Implementing the Run () method
Join (): suspends the current process until the called process ends
Start (): Starts the process, executes the code in run
Inter-process communication
The memory space of the process is independent of each other
Through multiprocessing. Queue Implementation Communication
Queue.put ()
Queue.get ()
Python language Learning (eight) 1.1