除了 Erlang 之外,还有哪些系统是基于“绿色流程”的?

发布于 2024-08-15 09:24:13 字数 455 浏览 10 评论 0原文

我正在 Green Thread (Wikipedia) 上阅读此信息页面,我想知道:还有哪些其他编程系统依赖 Erlang 之外的“绿色进程”?

编辑:“绿色线程!=绿色进程”

基于

  • Erlang
  • Inferno

绿色线程基于

  • Go

Native进程基于

  • C,C ++

更新:没有人回答直接回答这个问题,所以我接受了一个答案,该答案为我提供了有关绿色流程的更多信息。

I was reading this informative page on Green Thread (Wikipedia) and I wonder: what other programming systems rely on "green processes" beside Erlang?

Edit: " Green Thread != Green Process "

Green Process based

  • Erlang
  • Inferno

Green Thread based

  • Go

Native Process based

  • C, C++

Updated: Nobody answered the question directly and so I have accepted an answer that provided me with more information with regards to Green Processes in general.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

桃扇骨 2024-08-22 09:24:13

关于整个“绿线”的名称,请参阅这篇文章的评论

更严肃地说,我很惊讶地看到您使用 Java 阵营的术语,而不是像“用户空间协作线程”这样的术语;好人 Peter van der Linden 解释了这个术语的起源:

当 Java 1.0 首次在 Solaris 上发布时,它并没有使用本机 Solaris 库 libthread.so 来支持线程。相反,它使用了为代号“Green”的早期项目用 Java 编写的运行时线程支持。该线程库后来被称为“绿色线程”。

我希望我们可以使用操作系统中的术语,例如线程的用户空间与内核调度。毕竟,这是操作系统级别的区别。 “绿色线程”这个名字只是Java的历史。

Regarding the whole "green thread" as a name, see comments on this post:

More seriously, I'm surprised to see you using a term from the Java camp, instead of something less jargony like "user-space cooperative threading"; nice guy Peter van der Linden explains the origin of the term:

When Java 1.0 first came out on Solaris, it did not use the native Solaris library libthread.so to support threads. Instead it used runtime thread support that had been written in Java for an earlier project code-named "Green." That thread library came to be known as "green threads."

I wish we could use the terminology from operating systems instead, e.g. user-space vs kernel scheduling of threads. After all, it is an operating system level distinction. The name "green thread" is only Java history.

愿得七秒忆 2024-08-22 09:24:13

据我了解,这些“绿色进程”其实和绿色线程没有本质区别。缺乏共享状态是由语言设计造成的,而不是由任何技术或巨大的概念差异造成的。 Erlang 简单地说:

  • 没有任何可以从多个进程访问的全局变量
  • 只允许通过显式消息在进程之间进行通信
  • 隐式复制消息参数(该技术的一大缺点)

因此,两个进程无法访问相同的内存,即使它们可能在操作系统级别共享虚拟内存(我猜这使得 Erlang 更容易在没有操作系统级别线程的体系结构上实现)。

As I understand it, these "green processes" are in fact not fundamentally different from green threads. The lack of shared state results from the language design, not from any technolgical or huge conceptual difference. Erlang simply:

  • Does not have any kind of global variables that would be accessible from multiple processes
  • Allows communication between processes only through explicit messages
  • Implicitly copies message parameters (the big drawback of this technique)

Thus, there is no way for two processes to access the same memory, even though they might have shared virtual memory on the OS level (which I guess makes Erlang easier to implement on architectures that don't have OS-level threads).

世界和平 2024-08-22 09:24:13

Java 直到 1.2 才使用它们。然后他们意识到,调度两次的较轻线程效率并不高。

Java used them until 1.2.. then they realized that having a lighter thread that is scheduled twice wasn't so efficient.

摇划花蜜的午后 2024-08-22 09:24:13

现在,还有 Rust(参见 rust-lang.org),它有一个用于 N:M 线程的模块和一个用于内核线程的模块。

Now, there is also Rust (see rust-lang.org) which has a module for N:M threads and one for kernel threads.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文