Content deleted Content added
m r2.7.1) (Robot: Adding uk:Global Interpreter Lock |
Concurrency is not the same as parallelism. Concurrency means overlapping operations; parallelism means operations happening simultaneously. |
||
Line 3:
A '''Global Interpreter Lock''' ('''GIL''') is a [[mutual exclusion]] [[lock (computer science)|lock]] held by a [[programming language]] [[interpreter (computing)|interpreter]] [[Thread (computer science)|thread]] to avoid sharing code that is not [[thread-safe]] with other threads. In languages with a GIL, there is always one GIL for each interpreter [[Process (computing)|process]]. [[CPython]] and [[CRuby]] use GILs.
Applications written in programming languages with a GIL can be designed to use separate processes to achieve full
== Benefits and drawbacks ==
Use of a Global Interpreter Lock in a language effectively limits the amount of parallelism reachable through [[Concurrency (computer science)|concurrency]] of a single interpreter process with multiple threads. If the process is almost purely made up of interpreted code and does not make calls outside of the interpreter for long periods of time (which can release the lock on the GIL on that thread while it processes), there is likely to be very little increase in speed when running the process on a [[multiprocessor]] machine. Due to signaling with a CPU-bound thread, it can cause a significant slowdown, even on single processors.<ref>{{cite web | url=http://www.dabeaz.com/python/GIL.pdf | title=Inside the Python GIL | author=David Beazley | publisher=[http://chipy.org/ Chicago Python User Group] | date=2009-06-11 | ___location=Chicago | accessdate=2009-10-07}}</ref>
Reasons for employing such a lock include:
|