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:

    “I do seriously believe that if we can measure among the States the benefits resulting from the preservation of the Union, the rebellious States have the larger share. It destroyed an institution that was their destruction. It opened the way for a commercial life that, if they will only embrace it and face the light, means to them a development that shall rival the best attainments of the greatest of our States.”
    —Benjamin Harrison (1833–1901)

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