Just one remark about multithreading though.
Each of Python threads will not execute line 2 at the same time. But something like this can happen:
thread 1 execute line 2 -> thread 2 execute line 2 -> thread 1 execute line 3 -> thread 2 execute line 3 !!! (size overflow)
Race condition.
Because of the GIL (Global Interpreter Lock) no line of Python can be executed at the same time when doing multithreading.
That's totally true. I didn't talk about it because it wasn't the main topic. Anyway on this subject you can use Processes instead of thread which don't suffer from GIL but i think they bring some overhead with them
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hello and thanks for this great article.
Just one remark about multithreading though.
Each of Python threads will not execute line 2 at the same time. But something like this can happen:
thread 1 execute line 2 -> thread 2 execute line 2 -> thread 1 execute line 3 -> thread 2 execute line 3 !!! (size overflow)
Race condition.
Because of the GIL (Global Interpreter Lock) no line of Python can be executed at the same time when doing multithreading.
That's totally true. I didn't talk about it because it wasn't the main topic. Anyway on this subject you can use Processes instead of thread which don't suffer from GIL but i think they bring some overhead with them