Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Stackless Python

From Wikipedia, the free encyclopedia
Alternative Python implementation
This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages)
icon
This articlerelies excessively onreferences toprimary sources. Please improve this article by addingsecondary or tertiary sources.
Find sources: "Stackless Python" – news ·newspapers ·books ·scholar ·JSTOR
(December 2017) (Learn how and when to remove this message)
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Stackless Python" – news ·newspapers ·books ·scholar ·JSTOR
(March 2013) (Learn how and when to remove this message)
(Learn how and when to remove this message)
Stackless Python
Original authorChristian Tismer
DeveloperAnselm Kruis
Initial release1998; 27 years ago (1998)
Stable release
3.8.1-slp[1] Edit this on Wikidata / January 22, 2020; 5 years ago (2020-01-22)
Preview release
3.9.0 alpha 0
Repository
Written inC,Python
Operating systemLinux,macOS,Windows
TypeInterpreter
LicensePython Software Foundation License
Websitegithub.com/stackless-dev

Stackless Python, orStackless, was aPython programming language interpreter. Its GitHub repository has been archived since February 2025, and the project has been officially discontinued.

It was so named because it avoids depending on theCcall stack for its own stack. In practice, Stackless Python uses the C stack, but the stack is cleared between function calls.[2] The most prominent feature of Stackless ismicrothreads, which avoid much of the overhead associated with usual operating systemthreads. In addition to Python features, Stackless also adds support forcoroutines, communicationchannels, and taskserialization.

Design

[edit]

With Stackless Python, a running program is split into microthreads that are managed by the language interpreter itself, not the operating systemkernelcontext switching andtask scheduling is done purely in the interpreter (these are thus also regarded as a form ofgreen thread). Microthreads manage the execution of different subtasks in a program on the same CPU core. Thus, they are an alternative to event-based asynchronous programming and also avoid the overhead of using separate threads for single-core programs (because no mode switching between user mode and kernel mode needs to be done, so CPU usage can be reduced).

Although microthreads make it easier to deal with running subtasks on a single core, Stackless Python does not remove CPython'sglobal interpreter lock (GIL), nor does it use multiple threads and/or processes. So it allows onlycooperative multitasking on a shared CPU and notparallelism (preemption was originally not available but is now in some form[3]). To use multiple CPU cores, one would still need to build an interprocess communication system on top of Stackless Python processes.

Due to the considerable number of changes in the source, Stackless Python cannot be installed on a preexisting Python installation as anextension orlibrary. It is instead a complete Python distribution in itself. The majority of Stackless's features have also been implemented inPyPy, aself-hosting Python interpreter andJIT compiler.[4]

Use

[edit]

Although the whole Stackless is a separate distribution, its switching functionality has been successfully packaged as aCPython extension called greenlet.[5] It is used by a number of libraries (e.g. gevent[6]) to provide agreen threading solution for CPython. Python since has received an alternative native solution for asynchronous programming running on a single thread:await/async.

Stackless is used extensively in the implementation of theEve Online massively multiplayer online game as well as inIronPort's mail platform.

See also

[edit]

References

[edit]
  1. ^"Release v3.8.1-slp". 12 August 2021. Retrieved8 March 2022.
  2. ^Archived atGhostarchive and theWayback Machine:The story of stackless Python.YouTube.
  3. ^"About Stackless". Archived fromthe original on 23 June 2020. Retrieved26 August 2016.a round robin scheduler is built in. It can be used to schedule tasklets either cooperatively or preemptively.
  4. ^"Application-level Stackless features — PyPy documentation".pypy.readthedocs.org.
  5. ^"greenlet: Lightweight concurrent programming — greenlet 0.4.0 documentation".greenlet.readthedocs.org.
  6. ^"What is gevent? — gevent 1.3.0.dev0 documentation".www.gevent.org.

External links

[edit]
Implementations
IDEs
Topics
Designer
Retrieved from "https://en.wikipedia.org/w/index.php?title=Stackless_Python&oldid=1310195651"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp