2007-05-30
multitask and Hive
multitask
multitask allows Python programs to use generators (aka coroutines) to perform cooperative multitasking and asynchronous I/O. Applications written using multitask consist of a set of cooperating tasks that yield to a shared task manager whenever they perform a (potentially) blocking operation, such as I/O on a socket or getting data from a queue. The task manager temporarily suspends the task (allowing other tasks to run in the meantime) and then restarts it when the blocking operation is complete. Such an approach is suitable for applications that would otherwise have to use select() and/or multiple threads to achieve concurrency.
Producer/Consumer with multitask library
Hive
This is a basic concurrency module that uses only dependencies available in the Python 2.5 standard library. It allows the creation of a jobfile for uses to queue work that any number of worker processes with access to the jobfile can pull from the queue and run.
看到这两个库很快就联想到曾经写过的那段代码,python2.5 增强的 yield 表达式所蕴涵的 continuation 的能力似乎终于有人拿它来发挥点实际作用了。
multitask allows Python programs to use generators (aka coroutines) to perform cooperative multitasking and asynchronous I/O. Applications written using multitask consist of a set of cooperating tasks that yield to a shared task manager whenever they perform a (potentially) blocking operation, such as I/O on a socket or getting data from a queue. The task manager temporarily suspends the task (allowing other tasks to run in the meantime) and then restarts it when the blocking operation is complete. Such an approach is suitable for applications that would otherwise have to use select() and/or multiple threads to achieve concurrency.
Producer/Consumer with multitask library
Hive
This is a basic concurrency module that uses only dependencies available in the Python 2.5 standard library. It allows the creation of a jobfile for uses to queue work that any number of worker processes with access to the jobfile can pull from the queue and run.
看到这两个库很快就联想到曾经写过的那段代码,python2.5 增强的 yield 表达式所蕴涵的 continuation 的能力似乎终于有人拿它来发挥点实际作用了。
发表评论
- 浏览: 37300 次
- 性别:


- 详细资料
搜索本博客
最近加入圈子
最新评论
-
metaclass in python (par ...
应该有django的Model
-- by 差沙 -
老子毕业了
哈哈,恭喜
-- by beyking -
新的 pep !
晕死,这种符号能打出来吗?
-- by towjzhou -
SQLAlchemy Examples
好,需要这样的例子。自己用只能是从文档中获取一些,高级的用法,需要花时间看源码, ...
-- by xlp223 -
强大的 sqlalchemy
sql是个基础,脱离它去谈orm,有如纸上谈兵。
-- by xlp223






评论排行榜