Skip to content

Multiple Interpreters #69

Closed
Closed

Description

@PythonLinks

Here is the PEP for multiple interpreters.
https://www.python.org/dev/peps/pep-0554/

It was rumored to be in Python3.7. Next I heard it would be in 3.8, then 3.9, now the Pep says provisional in 3.8, and they will make a decision about 3.9. I would not be surprised if multiple interpreters shipped first in gPython.

And I suspect that the cPython version will be one interpreter per OS thread. With gPython we could have thousands of interpreters.

I should also mention stackless.
https://github.com/stackless-dev/stackless/wiki

And finally the documents say that this is 1/5 th as fast as cPython. But I can easily get a server with 32 cores. And many applications now have little processing and lots of network I/O.

I just wonder what the killer app for this would be? It would be great to have a game, where a conference programming competition would be to win the multiplayer game, much like the snake competition at some recent Python conferences.

Warm Regards
Christopher Lozinski

Activity

  1. ncw commented on Aug 11, 2019

    @ncw
    Collaborator

    My plan is to implement a "go" modules with some low level support for go facilities

    • go routines
    • channels
    • mutex
    • select (maybe)

    This could then be used to make some higher level constructs eg the threading library.

    My plan is to make a new interpreter for each goroutine so they can run together without locking. I'm not sure that is exactly the level at which the PEP you linked works but it might be!

    Each goroutine would be able to access its own things without locking but accessing shared things would need locking.

    I have a plan for how to implement the "go" module somewhere... It involves making some new "special functions" in the interpreter

    gpython/vm/eval.go

    Lines 1582 to 1591 in fff175c

    // As py.Call but takes an intepreter Frame object
    //
    // Used to implement some interpreter magic like locals(), globals() etc
    func callInternal(fn py.Object, args py.Tuple, kwargs py.StringDict, f *py.Frame) (py.Object, error) {
    if method, ok := fn.(*py.Method); ok {
    switch x := method.Internal(); x {
    case py.InternalMethodNone:
    case py.InternalMethodGlobals:
    return f.Globals, nil
    case py.InternalMethodLocals:

  2. corona10 commented on Aug 11, 2019

    @corona10
    Collaborator

    @ncw If we implement this feature based on goroutine, I think this feature can be unique to gpython. I like this issue.

  3. PythonLinks commented on Aug 12, 2019

    @PythonLinks
    Author
  4. drew-512 commented on Feb 16, 2022

    @drew-512
    Contributor

    suggest close issue -- addressed w/ #158

  5. sbinet commented on Feb 22, 2022

    @sbinet
    Member

    fixed w/ #158.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions