I understand that from Python 3.2, the GIL works based on time of 5 miliseconds rather than 100 bytecodes before switching threads. However, if the operation needs a lock (needs to be atomic), then it waits for more than 5 milliseconds.
I want to know what the examples of operations that are atomic with respect to the GIL (e.g. assignment), non-atomic (e.g. increment) or release the GIL (e.g. reading). This will help programmer to know when to manage locks manually.
Example: Which category does the FOR/WHILE loops fall into?
So, based on the above list, the programmer has to implement his own locks to ensure that - for example - a non-atomic operation (increment) does not mess up the global variable value in a multi threaded program, because GIL only locks the atomic operation.