In the Python documentation about threads and the GIL, it says:
In order to emulate concurrency of execution, the interpreter regularly tries to switch threads (see
sys.setswitchinterval())
Why would it do this? These context switches appear to do nothing other than waste time. Wouldn't it be quicker to run each process until it releases the GIL, and then run the next?
sys.setswitchintervalis setting the interval a thread maximally would hold the GIL. @devoured elysium Python-threads are real OS-threads, not green-threads.asynciofor single-threaded concurrency.