I read that Python2 used a bytecode counter to decide when the GIL should switch execution between threads but that Python3 uses a timer.
I am wondering, how does the context switching process work? In particular how does the timer interrupt save the current context of the thread and switch to another thread?
In embedded systems this pretty straightforward but it's unclear to me how the python interpreter works with the OS to achieve this while keeping the context of the current thread intact.