编辑“︁
Stackless Python
”︁
跳转到导航
跳转到搜索
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
{{Infobox software | name = Stackless Python | logo = | screenshot = | caption = | collapsible = | author = Christian Tismer | developer = Anselm Kruis | released = {{Start date and age|1998}} | latest release version = v3.8.1-slp | latest release date = {{Start date and age|2021|08|12}} | latest preview version = | latest preview date = | programming language = [[C语言|C]], [[Python]] | operating system = [[Linux]], [[Microsoft Windows|Windows]] | platform = | size = | language = | genre = [[解释器]] | license = [[Python软件基金会许可证]] | website = }} '''Stackless Python'''或称简称'''Stackless''',是一个[[Python|Python编程语言]]解释器,这么称呼的原因是它避免了依赖[[C语言|C]][[调用栈]]为自己的堆栈。在实际中,Stackless Python使用了C堆栈,但是这个堆栈在函数调用之间是被清除的<ref>{{Cite web |url=https://www.youtube.com/watch?v=pDkrkP0yf70 |title=存档副本 |accessdate=2020-09-30 |archive-date=2020-08-29 |archive-url=https://web.archive.org/web/20200829130130/https://www.youtube.com/watch?v=pDkrkP0yf70 |dead-url=no }}</ref>。Stackless Python的最突出特征是{{le|微线程|Microthread}},它避免了与操作系统[[线程]]有关的大量开销。在Python特征之外,Stackless还增加了[[协程]]、通信[[通道 (编程)|通道]]和任务[[序列化]]。 ==设计== 对于Stackless Python,一个运行的程序被分解成微线程,由语言解释器自身而非操作系统[[内核]]管理,[[上下文切换]]和[[调度 (计算机)|任务调度]]纯粹在解释器内完成,因而可以被视作是一种形式的[[绿色线程]]。微线程管理在同一个CPU核心上一个程序的不同子任务的执行,Stackless Python不移除Python的[[全局解释器锁]], 也不使用多线程或多进程。所以它只允许在一个共享CPU核心上的[[协作式多任务]]而非[[并行计算|并行]],最初不能获得而现在有了某种形式的抢占<ref>{{cite web |url=https://bitbucket.org/stackless-dev/stackless/wiki/Home |title=About Stackless |quote=a round robin scheduler is built in. It can be used to schedule tasklets either cooperatively or preemptively. |accessdate=26 August 2016 |archive-date=2020-06-23 |archive-url=https://web.archive.org/web/20200623233250/https://bitbucket.org/stackless-dev/stackless/wiki/Home |dead-url=no }}</ref>。 由于相当数量的源代码变更,Stackless Python不能在现存的Python安装上作为一个[[插件|扩展]]或[[函式库|库]]来安装。它自身是完整的Python发行。大多数的Stackless Python的特征也在[[PyPy]]中实现了,它是{{le|自我寄宿|Self-hosting (compilers)}}的Python解释器和[[即时编译|JIT编译器]]<ref>{{cite web|url=http://pypy.readthedocs.org/en/latest/stackless.html|title=Application-level Stackless features — PyPy documentation|website=pypy.readthedocs.org|accessdate=2020-09-30|archive-date=2016-04-13|archive-url=https://web.archive.org/web/20160413211003/https://pypy.readthedocs.org/en/latest/stackless.html|dead-url=no}}</ref>。 ==使用== 尽管整个Stackless Python是一个独立发行,它的上下文切换功能已经成功的打包为叫做greenlet的[[CPython]]扩展<ref>{{cite web|url=http://greenlet.readthedocs.org/en/latest/|title=greenlet: Lightweight concurrent programming — greenlet 0.4.0 documentation|website=greenlet.readthedocs.org|accessdate=2020-09-30|archive-date=2016-04-16|archive-url=https://web.archive.org/web/20160416091857/http://greenlet.readthedocs.org/en/latest/|dead-url=no}}</ref>。它被用在很多库,比如gevent<ref>{{cite web|url=http://www.gevent.org|title=What is gevent? — gevent 1.3.0.dev0 documentation|website=www.gevent.org|accessdate=2020-12-09|archive-date=2020-09-16|archive-url=https://web.archive.org/web/20200916085654/http://www.gevent.org/|dead-url=no}}</ref>,用来提供CPython的[[绿色线程]]解决方案。Python现在已经接受了对绿色线程的原生解决方案:[[async/await]]。 Stackless Python广泛的使用在大规模多玩家在线游戏{{le|Eve Online|Eve Online}}的实现和{{le|IronPort|IronPort}}的邮件平台。 ==引用== {{Reflist|2}} ==参閱== {{Portal|自由软件}} * [[Erlang]] * [[Limbo (程式语言)]] * [[Go語言|Go]] * {{le|SCOOP (软件)|SCOOP (software)}} ==外部链接== * Stackless Python Documentation for: [https://stackless.readthedocs.io/en/3.7-slp/stackless-python.html 3.7-slp]{{Wayback|url=https://stackless.readthedocs.io/en/3.7-slp/stackless-python.html |date=20190331231737 }}, [https://stackless.readthedocs.io/en/3.6-slp/stackless-python.html 3.6-slp]{{Wayback|url=https://stackless.readthedocs.io/en/3.6-slp/stackless-python.html |date=20190209180414 }}, [https://stackless.readthedocs.io/en/3.5-slp/stackless-python.html 3.5-slp]{{Wayback|url=https://stackless.readthedocs.io/en/3.5-slp/stackless-python.html |date=20190331231741 }}, [https://stackless.readthedocs.io/en/3.4-slp/stackless-python.html 3.4-slp]{{Wayback|url=https://stackless.readthedocs.io/en/3.4-slp/stackless-python.html |date=20190331231743 }}, [https://stackless.readthedocs.io/en/2.7-slp/stackless-python.html 2.7-slp]{{Wayback|url=https://stackless.readthedocs.io/en/2.7-slp/stackless-python.html |date=20190331231800 }} * {{GitHub|stackless-dev/stackless}} * [http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/ Multithreaded Game Scripting with Stackless Python]{{Wayback|url=http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/ |date=20170702173643 }} by Harry Kalogirou * [https://web.archive.org/web/20121108011701/http://zope.stackless.com/spcpaper.htm Continuations and Stackless Python] by Christian Tismer {{-}} {{Python|state=collapsed}} [[Category:并发计算]] [[Category:Python]] [[Category:采用Python软件基金会许可证的软件]]
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
页面
讨论
大陆简体
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息