Ruby 语言 思想驱动生活

May 28, 2007

fiber

Filed under: Ruby — liubin @ 12:06

关于新版本Ruby中的多线程的问题。
fiber microthread coroutine concurrency这几个名词都被使用,可能最常用的会是fiber。
fiber属于非抢占式(non-preemptive)类型。
引用msdn文档:A fiber is a unit of execution that must be manually scheduled by the application
意思就是说必须手动调度的一段可执行单元
fiber运行在线程的上下文中,一个进程可以调度多个fiber。线程一般要依靠内核的线程调度来暂停或者重启其它线程,而fiber则自己控制自己,启动其它fiber等。

Fiber和coroutine
这两个概念非常相近,一般来说,coroutine是程序语言级别的结构,而fiber是系统级别的结构。

WIKI条目:
1 Fiber (computer science)
2 Coroutine
MSDN文档:http://msdn2.microsoft.com/en-us/library/ms682661.aspx

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Powered by WordPress