Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2006-09-05 13:30:12
Size: 1208
Editor: HuangYi
Comment: Stackless Python
Revision 5 as of 2009-12-25 07:10:15
Size: 3635
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[[TableOfContents]] <<TableOfContents>>
Line 5: Line 5:
Stackless Python 是 Python 编程语言的一个增强版本。它能让程序员获得基于线程编程的好处的同时,还不用考虑传统线程带来的性能和灵活性问题。由 Stackless 添加到 Python 中的微线程是一个便宜且轻量的便利工具,如果用得恰当的话,它能提供以下好处: Stackless Python 是 Python 编程语言的一个增强版本。它能让程序员获得基于线程编程的好处的同时,还不用考虑传统线程带来的性能和灵活性问题。由 Stackless 添加到 Python 中的微线程是一个便宜且轻量的便利工具,如果用得恰当的话,它能提供以下好处:
Line 8: Line 8:
 * 提高速度  * 提高程序员生产力
Line 15: Line 15:
== 相关链接 ==
[http://www.stackless.com/ 官方首页]
[http://www.python.org/workshops/2000-01/proceedings/papers/tismers/spcpaper.htm Continuations and Stackless Python
Or "How to change a Paradigm of an existing Program"]
== 示例 ==
== 特性 ==
对于所有通过使用 Stackless 所能获得的便利来说,通过 stackless 模块暴露出来的功能其实只有其中很少的一部分。通过阅读以下页面提供的信息,你将会对这些概念熟悉起来的:

 * [[http://www.stackless.com/wiki/Tasklets|Microthreads]]. Tasklets 对函数进行包装,然后便可以作为微线程而启动。
 * [[http://www.stackless.com/wiki/Channels|Channels]]. Channels 可以用来在 tasklets 之间进行双向的通讯。
 * [[http://www.stackless.com/wiki/Scheduling|Scheduling]]. 内置了一个 round robin 调度器。它可以以合作或抢占式两种方式对 tasklets 进行调度。
 * [[http://www.stackless.com/wiki/Pickling|Serialisation]]. Tasklets 可以通过 pickling 序列化到磁盘上,稍后再继续执行。

For all the convenience gained through using Stackless, there is really only a minimal amount of functionality exposed through the stackless module. You can get more familiar with these aspects by reading the information provided in the following pages:

    * [[http://www.stackless.com/wiki/Tasklets|Microthreads]]. Tasklets wrap functions allowing them to be launched as microthreads.
    * [[http://www.stackless.com/wiki/Channels|Channels]]. Channels can be used for bidirectional communication between tasklets.
    * [[http://www.stackless.com/wiki/Scheduling|Scheduling]]. A round robin scheduler is built in. It can be used to schedule tasklets either cooperatively or preemptively.
    * [[http://www.stackless.com/wiki/Pickling|Serialisation]]. Tasklets can be serialised to disk through pickling for later resumption of execution.

== 相关文档 ==
 * [[http://www.stackless.com/|官方首页]]
 * [[http://members.verizon.net/olsongt/stackless/|Introduction to Concurrent Programming with Stackless Python]]
 * [[http://www.python.org/workshops/2000-01/proceedings/papers/tismers/spcpaper.htm|Continuations and Stackless Python Or "How to change a Paradigm of an existing Program"]]
 * [[http://www.python.org/dev/peps/pep-0219/|pep-0219 Stackless Python]]
 * [[http://codespeak.net/svn/pypy/dist/pypy/doc/discussion/howtoimplementpickling.txt|Designing thread pickling or "the Essence of Stackless Python"]]
 * [[http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/|Multithreaded Game Scripting with Stackless Python]]
 * [[http://www.imperialviolet.org/stackless/|Stackless]]
 * [[http://willware.net:8080/uthread.html|Python Microthreads]]
== 相关代码 ==
 * [[HuangYi/yield_stacklesspython| 使用 yield 模拟 stacklesspython, 也许能帮助理解其机制]]

Stackless Python

简介

Stackless Python 是 Python 编程语言的一个增强版本。它能让程序员在获得基于线程编程的好处的同时,还不用考虑传统线程带来的性能和灵活性的问题。由 Stackless 添加到 Python 中的微线程是一个便宜且轻量的便利工具,如果用得恰当的话,它能提供以下好处:

  • 改良程序结构
  • 增强代码可读性
  • 提高程序员生产力

Stackless Python is an enhanced version of the Python programming language. It allows programmers to reap the benefits of thread-based programming without the performance and complexity problems associated with conventional threads. The microthreads that Stackless adds to Python are a cheap and lightweight convenience which can if used properly, give the following benefits:

  • Improved program structure.
  • More readable code.
  • Increased programmer productivity.

特性

对于所有通过使用 Stackless 所能获得的便利来说,通过 stackless 模块暴露出来的功能其实只有其中很少的一部分。通过阅读以下页面提供的信息,你将会对这些概念熟悉起来的:

  • Microthreads. Tasklets 对函数进行包装,然后便可以作为微线程而启动。

  • Channels. Channels 可以用来在 tasklets 之间进行双向的通讯。

  • Scheduling. 内置了一个 round robin 调度器。它可以以合作或抢占式两种方式对 tasklets 进行调度。

  • Serialisation. Tasklets 可以通过 pickling 序列化到磁盘上,稍后再继续执行。

For all the convenience gained through using Stackless, there is really only a minimal amount of functionality exposed through the stackless module. You can get more familiar with these aspects by reading the information provided in the following pages:

  • Microthreads. Tasklets wrap functions allowing them to be launched as microthreads.

  • Channels. Channels can be used for bidirectional communication between tasklets.

  • Scheduling. A round robin scheduler is built in. It can be used to schedule tasklets either cooperatively or preemptively.

  • Serialisation. Tasklets can be serialised to disk through pickling for later resumption of execution.

相关文档

相关代码

讨论

StacklessPython (last edited 2009-12-25 07:10:15 by localhost)