World Library  
Flag as Inappropriate
Email this Article

Stackless Python

Article Id: WHEBN0002009536
Reproduction Date:

Title: Stackless Python  
Author: World Heritage Encyclopedia
Language: English
Subject: Python (programming language), Nagare (web framework), Tulip (python project), Python Conference, CLPython
Publisher: World Heritage Encyclopedia

Stackless Python

Stackless Python
Original author(s) Christian Tismer
Written in C, Python
Operating system Linux, Mac OS X, Windows
Type Interpreter
License Python Software Foundation License
Website .com.stacklesswww

Stackless Python, or Stackless, is a Python programming language interpreter, so named because it avoids depending on the C call stack for its own stack. The most prominent feature of Stackless is microthreads, which avoid much of the overhead associated with usual operating system threads. In addition to Python features, Stackless also adds support for coroutines, communication channels and task serialization.


With Stackless Python, a running program is split into microthreads that are managed by the language interpreter itself, not the operating system kernelcontext switching and task scheduling is done purely in the interpreter (these are thus also regarded as a form of green thread). Microthreads manage the execution of different subtasks in a program on a 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 neither removes Python's global interpreter lock nor utilises multiple threads and/or processes. So it allows only cooperative multitasking on a shared CPU and not parallelism or preemption. To utilise multiple CPU cores, one would still need to build an interprocess communication 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 an extension or library. It is instead a complete Python distribution in itself. The majority of Stackless's features have also been implemented in PyPy, a self-hosting Python interpreter and JIT compiler.


Although the whole Stackless is a separate distribution, its switching functionality has been successfully packaged as a CPython extension called greenlet. It is used by a number of libraries (e.g. gevent) to provide a "green threading" solution for CPython.

Stackless is used extensively in the implementation of the Eve Online massively multiplayer online game to provide for concurrency,[1] as well as in IronPort's mail platform.

See also


  1. ^ Combs, Nate (2005-10-14). "Nested Worlds". Terra Nova. 

External links

  • Project home page
  • Multithreaded Game Scripting with Stackless Python by Harry Kalogirou
  • Continuations and Stackless Python by Christian Tismer
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Hawaii eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.