The Wayback Machine - https://web.archive.org/web/20200910210613/https://github.com/go-python/gpython/issues/64
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there anything like GIL? #64

Open
yanchenghust opened this issue Jul 24, 2019 · 5 comments
Open

Is there anything like GIL? #64

yanchenghust opened this issue Jul 24, 2019 · 5 comments
Labels

Comments

@yanchenghust
Copy link

@yanchenghust yanchenghust commented Jul 24, 2019

As we know, CPython implemention has a GIL.
How about gpython?

@ncw
Copy link
Collaborator

@ncw ncw commented Jul 24, 2019

gpython does not contain a GIL.

However it does not, as yet allow any sort of multiprocessing.

It is my plan to make a threading library which under the hood creates go routines. At this point it will need some sort of locking...

@ncw ncw added the question label Jul 24, 2019
@sbinet
Copy link
Member

@sbinet sbinet commented Jul 29, 2019

by threading library, you mean exposing a gpython module to the Python interpreter, right?

the skylark Python-like VM has actually the concept of a Thread state that is passed to each API call...

WDYT about this?

@ncw
Copy link
Collaborator

@ncw ncw commented Jul 29, 2019

by threading library, you mean exposing a gpython module to the Python interpreter, right?

Yes. My plan was to make a low level module exposing some go features like goroutines, channels, locks etc, and use that low level module to build up something which was API compatible with the threading module.

the skylark Python-like VM has actually the concept of a Thread state that is passed to each API call...

That sounds like a job for a context passed everywhere. We've already identified somewhere else that would be very useful! Go having no thread local storage makes it very difficult to translate some bits of python.

WDYT about this?

I think we'd almost certainly need something very similar! I'd propose to attach it to a context though.

@sbinet
Copy link
Member

@sbinet sbinet commented Jul 30, 2019

I think we'd almost certainly need something very similar! I'd propose to attach it to a context though.

SGTM. (we should probably make sure extracting informations and/or restoring state from that context.Context isn't showing abysmal performances, though.)

@ncw
Copy link
Collaborator

@ncw ncw commented Jul 30, 2019

SGTM. (we should probably make sure extracting informations and/or restoring state from that context.Context isn't showing abysmal performances, though.)

Hmm, yes! AFAICS context is implemented as linked list, so the lookup isn't very efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.