Skip to content

Commit

Permalink
Merge pull request #54 from nayeonshin/nshin_fix-typo
Browse files Browse the repository at this point in the history
docs(gil): fix typo
  • Loading branch information
zpoint authored Dec 13, 2023
2 parents f3e7e81 + 35bab7d commit 7a8d178
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Interpreter/gil/gil.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ you can call `sys.setcheckinterval()` to set other **tick** count value instead

because the **tick** is not time-based, some thread might run far longer than other threads

in multi-core machine, if two threads both running CPU-bound tasks, the os might schedule the two threads running on different cores, there might be a situation that one thread holding the **gil** executing it's task in it's **100 ticks cycle** in a core, while the thread in the other core wakes up preiodly try to acquire the **gil** but fail, spinning the CPU
in multi-core machine, if two threads both running CPU-bound tasks, the os might schedule the two threads running on different cores, there might be a situation that one thread holding the **gil** executing it's task in it's **100 ticks cycle** in a core, while the thread in the other core wakes up periodically try to acquire the **gil** but fail, spinning the CPU

the job(thread) schedule mechanism is fully controlled by the operating system, the thread handling IO-bound task have to wait for other thread to release the **gil**, and other thread might re-acquire the **gil** after it release the **gil**, which makes the current IO-bound task thread wait even longer (actually, the thread that cause os's context-switch by it self will have higher priority than those thread forced by os, programmer can utilize this feature by putting the IO-bound thread to sleep as soon as possible)

Expand Down

0 comments on commit 7a8d178

Please sign in to comment.