Article 2KRB1 Grok the GIL (opensource.com)

Grok the GIL (opensource.com)

by
corbet
from LWN.net on (#2KRB1)
Here's anopensource.com article describing how the Python global interpreterlock works and some nuances of writing threaded Python code."Although the GIL does not excuse us from the need for locks, it doesmean there is no need for fine-grained locking. In a free-threaded languagelike Java, programmers make an effort to lock shared data for the shortesttime possible, to reduce thread contention and allow maximumparallelism. Because threads cannot run Python in parallel, however,there's no advantage to fine-grained locking. So long as no thread holds alock while it sleeps, does I/O, or some other GIL-dropping operation, youshould use the coarsest, simplest locks possible."
External Content
Source RSS or Atom Feed
Feed Location http://lwn.net/headlines/rss
Feed Title LWN.net
Feed Link https://lwn.net/
Reply 0 comments