Concurrency: The system has the ability to handle multiple tasks (actions)
Parallelism: The system has the ability to simultaneously handle multiple tasks (actions)
Synchronization: When the process executes to an IO (waiting for external data), it waits, waits, synchronizes
Async: When a process executes to an IO (waiting for external data), it does not need to wait until the data is received successfully and then comes back to processing.
GIL: Global explanation Lock: No matter how many threads you have, how many cpu,python you have in the execution will only allow one thread to run at the same time. (Interpreter level protection process security)
Gil's role: At the same time, only one thread is executed by the CPU, resulting in single-threaded run results, and multicore is not available.
Garbage collection mechanism: a thread of the interpreter is being garbage collected.
CPU switchover: IO Blocking, CPU Execution time window, etc.
Threads are competing for CPU resources to get executed.
tasks: IO-intensive (multiple IO interactions, more CPU idle time), compute-intensive (), time.sleep () equivalent to IO operations
For IO-intensive tasks, Python's multithreading is meaningful, and computational-intensive tasks, Python's multithreading is not applicable, you can use multi-process.
Sync Lock: Thread is set to Serial, Lock=threading.lock (), Lock.acquire (), Lock.release ()
python-concurrency Parallel, synchronous asynchronous, synchronous lock