Global Interpreter Lock (GIL)

정은경·2020년 7월 25일
0

cpu 하나당 하나의 쓰레드만 쓰는 것!

  • The GIL is a single lock on the interpreter itself which adds a rule that execution of any Python bytecode requires acquiring the interpreter lock. This prevents deadlocks (as there is only one lock) and doesn’t introduce much performance overhead. But it effectively makes any CPU-bound Python program single-threaded.
  • The GIL, although used by interpreters for other languages like Ruby, is not the only solution to this problem. Some languages avoid the requirement of a GIL for thread-safe memory management by using approaches other than reference counting, such as garbage collection.
  • On the other hand, this means that those languages often have to compensate for the loss of single threaded performance benefits of a GIL by adding other performance boosting features like JIT compilers.

동시성(concurrency) != 병렬성(parallelism)

Reference

Reference

profile
#의식의흐름 #순간순간 #생각의스냅샷

0개의 댓글