Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Raku have a global interpreter lock (GIL)?

Tags:

raku

The Wikipedia article Global interpreter lock indicates that Raku has a global interpreter lock.

This contradicts Curtis Poe's response to Are any companies planning to use Perl 6?.

I suspect that the Wikipedia article is wrong - but maybe it is more complicated than that. Can somebody explain?

like image 486
Ross Attrill Avatar asked May 01 '16 22:05

Ross Attrill


People also ask

What is global interpreter lock GIL in Python?

The Python Global Interpreter Lock or GIL, in simple words, is a mutex (or a lock) that allows only one thread to hold the control of the Python interpreter. This means that only one thread can be in a state of execution at any point in time.

Does Ruby have a global interpreter lock?

Some language implementations that implement a global interpreter lock are CPython, the most widely-used implementation of Python, and Ruby MRI, the reference implementation of Ruby (where it is called Global VM Lock). JVM-based equivalents of these languages (Jython and JRuby) do not use global interpreter locks.

Why does CPython have GIL?

The GIL provides an important simplifying model of object access (including refcount manipulation) because it ensures that only one thread of execution can mutate Python objects at a time5. There are important performance benefits of the GIL for single-threaded operations as well.

Why does Python have a global interpreter lock?

The Global Interpreter Lock In other words, the lock ensures that only one thread is running at any given time. Therefore, it is impossible to take advantage of multiple processors with threads. Since the CPython's memory management is not thread-safe, the GIL prevents race conditions and ensures thread safety.

What is global interpreter lock (GIL)?

Global Interpreter Lock is easy to implement in python as it only needs to provide a single lock to a thread for processing in python. The GIL is simple to implement and was easily added to Python. It provides a performance increase to single-threaded programs as only one lock needs to be managed. Impact on multi-threaded Python programs :

What is a Gil lock in Java?

A global interpreter lock (GIL) is a mutual-exclusion lock held by a programming language interpreter thread to avoid sharing code that is not thread-safe with other threads. In implementations with a GIL, there is always one GIL for each interpreter process .

Which Python interpreters have Gil?

Some popular interpreters that have GIL are CPython and Ruby MRI . A global interpreter lock (GIL) is a mutual-exclusion lock held by a programming language interpreter thread to avoid sharing code that is not thread-safe with other threads.

What is a Gil in programming language?

Technical background concepts. A global interpreter lock (GIL) is a mutual-exclusion lock held by a programming language interpreter thread to avoid sharing code that is not thread-safe with other threads. In implementations with a GIL, there is always one GIL for each interpreter process.


1 Answers

With some googling I've found some additional evidence that Perl 6 indeed has no GIL:

As the creator of Perl himself stated in an interview:

[...] For developers who are already sophisticated, they'll see that most of the problems endemic to the currently available dynamic languages are solved in Perl 6. We understand lexical and dynamic scoping. We detect most typos at compile time. We don't have a global interpreter lock.

Source: Perl creator Larry Wall: Rethought version 6 due this year

Some more evidence:

  • https://news.ycombinator.com/item?id=10640765
  • https://www.reddit.com/r/perl6/comments/3goq1a/not_having_gil_truly_multithreading/
  • https://www.reddit.com/r/perl/comments/337h4c/should_i_also_learn_perl6_knowing_ruby_and_python/

I don't know why, but the addition of Perl 6 to the Wikipedia article was done two weeks ago and maybe it needs to be reverted.

like image 73
Agis Avatar answered Sep 25 '22 10:09

Agis