Stackless Python
Encyclopedia
Stackless Python, or Stackless, is a Python programming language
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 interpreter, so named because it avoids depending on the C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 call stack
Call stack
In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, control stack, run-time stack, or machine stack, and is often shortened to just "the stack"...

 for its own stack. The most prominent feature of Stackless is microthread
Microthread
Microthreads are small code fragments that can be run concurrently to gain increased performance in microprocessors. They provide an execution model that uses a few additional instructions in a conventional processor to break code down into fragments that execute simultaneously...

s, which avoid much of the overhead associated with usual operating system thread
Thread (computer science)
In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...

s. In addition to Python features, Stackless also adds support for coroutine
Coroutine
Coroutines are computer program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations...

s, communication channels
Channel (programming)
A Channel is a construct used in interprocess communication to represent some binding between concurrent processes. An object may be sent over a channel, and a process is able to receive any objects sent over a channel it has a reference to...

 and task serialization
Serialization
In computer science, in the context of data storage and transmission, serialization is the process of converting a data structure or object state into a format that can be stored and "resurrected" later in the same or another computer environment...

.

Stackless microthreads are managed by the language interpreter itself, not the operating system kernel—context switch
Context switch
A context switch is the computing process of storing and restoring the state of a CPU so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU. The context switch is an essential feature of a multitasking operating system...

ing and task scheduling is done purely in the interpreter (these are thus also regarded as a form of green thread
Green threads
In computer programming, green threads are threads that are scheduled by a virtual machine instead of natively by the underlying operating system...

). This avoids many of the overheads of threads, because no mode switching between user mode and kernel mode needs to be done, and can significantly reduce CPU load in some high-concurrency
Concurrency (computer science)
In computer science, concurrency is a property of systems in which several computations are executing simultaneously, and potentially interacting with each other...

 situations.

Due to the considerable number of changes in the source, Stackless Python cannot be installed on a preexisting Python installation as an extension
Extension (computing)
Software extension, is a file containing programming that serves to extend the capabilities of or data available to a more basic program. It is a kind of list of commands which are directly included in the program. This term often coincides with the plug-in...

 or library
Library (computer science)
In computer science, a library is a collection of resources used to develop software. These may include pre-written code and subroutines, classes, values or type specifications....

. It is instead a complete Python distribution in itself. The majority of Stackless' features have also been implemented in PyPy
PyPy
PyPy is a Python interpreter and JIT compiler. PyPy focuses on speed, efficiency and 100% compatibility with the original CPython interpreter.- Details and motivation :...

, a self-hosting
Self-hosting
The term self-hosting was coined to refer to the use of a computer program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is commonplace on personal computers and larger...

 Python interpreter and JIT compiler.

Use

Although the whole Stackless is a separate distribution, its switching functionality has been successfully packaged as a CPython
CPython
CPython is the default, most-widely used implementation of the Python programming language. It is written in C. In addition to CPython, there are two other production-quality Python implementations: Jython, written in Java, and IronPython, which is written for the Common Language Runtime. There...

 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
EVE Online
Eve Online is a video game by CCP Games. It is a player-driven, persistent-world MMORPG set in a science fiction space setting. Characters pilot customizable ships through a galaxy of over 7,500 star systems. Most star systems are connected to one or more other star systems by means of stargates...

massively multiplayer online game to provide for concurrency, as well as in IronPort
IronPort
IronPort Systems, Inc., headquartered in San Bruno, California, was a company that designed and sold products and services that protect enterprises against Internet threats. It was best known for IronPort AntiSpam, the SenderBase email reputation service, and email security appliances...

's mail platform. Second Life
Second Life
Second Life is an online virtual world developed by Linden Lab. It was launched on June 23, 2003. A number of free client programs, or Viewers, enable Second Life users, called Residents, to interact with each other through avatars...

is also beginning to use it.

See also

  • Erlang (programming language)
  • Limbo (programming language)
  • SCOOP (software)
    SCOOP (software)
    SCOOP stands for Simple Concurrent Object Oriented Programming. It is a concurrency model designed for the Eiffel programming language, conceived by Eiffel's creator and designer, Bertrand Meyer....


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK