Global Interpreter Lock - Benefits and Drawbacks

Benefits and Drawbacks

Use of a Global Interpreter Lock in a language effectively limits the amount of parallelism reachable through 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.

Reasons for employing such a lock include:

  • increased speed of single-threaded programs (no necessity to acquire or release locks on all data structures separately)
  • easy integration of C libraries that usually are not thread-safe.

Read more about this topic:  Global Interpreter Lock

Famous quotes containing the words benefits and/or drawbacks:

    When your parents are in political life, you aren’t normal. Everybody talks about the benefits, but I don’t know what the benefits are.... But I’d rather have that kind of mother than an overweight housewife.
    Katherine Berman Mariano (b. 1957)

    France has neither winter nor summer nor morals—apart from these drawbacks it is a fine country.
    Mark Twain [Samuel Langhorne Clemens] (1835–1910)