- 浏览: 579689 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
JamAndVariousAbalone:
存储方式的不同吧。gb_tree是平衡树,list是线性结构。 ...
gb_trees和lists的访问效率相差很大 -
genesislive:
eporf:analyse()写错了,应该改成eprof:an ...
Erlang程序的性能测试工具(1) -
vampirezh:
高手啊 求带 ! 请列出带徒标准
Erlang的未来(2008) -
aiquantong:
great!
rebar工具使用备忘录 (1) -
wccxiaoan:
basho的资源 都没办法打开,不过还是有帮助,谢谢。
关于webmachine
进程组、任务和JCL(Process group, Jobs and JCL)
As Erlang evolved there was the idea that Erlang was, in many ways, like an operating system, not just a language running within an OS. One result of this way of thinking was that in one Erlang system you would want to run many separate applications concurrently. Each application would consist of a number of processes working together but sharing the basic Erlang system. As the applications were separate then there would be general “system” information that would be specific for each application but it should be able to be accessed in a common way.
随着Erlang的进化,在某种程度上它有点像一个操作系统,而不仅仅是运行在OS上的一门语言。这样导致在一个Erlang系统中你可能会想并行的运行许多单独的(互不相干的,separate)应用。每个应用由许多的进程组成,它们一起工作,一起分享基础Erlang系统。由于应用是互不相干的,每个应用应该都会有通用的“系统”信息,虽然每个应用都是特定的,但是每个应用应该能够用一种通用的方式访问。
To address this problem process groups were created. They are not the same as the UNIX concept of the same name. It was decided keep the flat, independent process structure which already existed, and still exists, and not impose a tree structure as exists in UNIX. This means that the process group is a much looser entity and in many ways completely transparent.
为解决这一问题创建了进程组。它们与同名的UNIX概念不同。我们决定保持平坦的(flat)、现有的(而且将来依然存在的)独立的进程结构,而不是像UNIX那样强加一个树形结构。这意味着进程组是一个更松散的实体(entity),在许多方面完全透明。
Each process has a ‘group leader’ which it inherits from the process which spawned it. A process group consists of all the processes which have the same group leader. The group leader is a normal process which has no a priori knowledge of the processes in its group. A process can change group simply by setting its ‘group leader’ to another process.
每个进程都有一个进程组组长(group leader),它从创建此进程的进程继承而来。一个进程组由所有有着相同group leader的进程组成。group leader是一个普通的进程,对它组里的进程它预先并没有太多的了解。一个进程可以改变它的组,只需简单的将它的group leader设置为另一进程即可。
Processes could then communicate with the group leader to get the process group’s common data.
进程可以与group leader通讯以获取进程组的共同数据。
There was much system information which could be “specialised” in this way; two obvious ones are default i/o streams and current working directory. Unfortunately this feature was never used to its full extent and is now only used for default i/o, the standard group leader process is an i/o-server process. Two reasons for it not being used is that the idea of running multiple applications on one Erlang system is not the common use (correct me if I am wrong) and the general lack of knowledge of the feature (again, correct me I am wrong).
采用这种方式会有许多系统信息成为特别(specialised)信息。最显而易见的两个是缺省I/O流和当前工作路径。不幸的是,此特征现在只在缺省I/O中用到,一个标准的group leader进程例子是I/O服务器进程。没有这样做有两个原因:在一个Erlang系统中运行多个应用并不常见(如果俺错了请帮忙指出);普遍缺乏对特征的了解(再次的,如果俺错了请帮忙指出)。
It would be good to have some example programs that illustrate this ☺
这里最好有些例子程序说明这点。
Using process groups it is very easy for different applications to have different default i/o channels. For example some could be communicating through separate windows, some directly to a file and some over TCP to another system (a browser interface to Erlang).
通过使用进程组可以非常容易的使不同的应用有不同的缺省I/O通道。例如,一些应用可以通过独立的窗口(windows)通信,一些应用可以直接访问一个文件,一些应用可以通过TCP连接到其它系统(一个对Erlang的浏览器接口???)。
One problem with running multiple applications concurrently is that if more than one is communicating with the user through the same channel then the i/o will become very jumbled.
并行的运行多个应用会有一个问题:如果有超过一个的应用通过相同的通道与用户通讯,I/O将变得非常混乱。
The solution to this was to introduce the concept of a ‘job’ and a user driver which controls which job is currently connected to, and hence communicating with, the user. A job is a process group together with its group leader. The user driver communicates the job through its group leader. Within the user driver you can start new jobs both locally and remotely, kill jobs and change which job is connected to the user. The i/o from jobs which are not connected is buffered (simply by not receiving it) until another job is connected and its i/o sent to the user. Controlling jobs in the user driver is done with JCL(Job Control Language).
解决办法是引进job和用户驱动器(user driver)的概念,user driver用来控制当前正在连接的是哪个job(以及正在与哪个用户通讯)。一个job是一个进程组及其group leader。user driver通过job的group leader与该job通信。在user driver内,你可以在本地也可以远程的启动新的jobs,或者杀掉jobs,以及修改由哪个job连接到用户。来自jobs的还没连接的I/O会被缓冲(通过不接受它),直到另一个job连接上,它的I/O会被发送给用户。通过JCL可以在user driver内控制jobs。
In the current implementation only new jobs running Erlang shells can be started but this is not an inherent limitation, any function could be spawned instead. In LFE(Lisp Flavoured Erlang, a new front end to Erlang with Lisp syntax) the user_drv module has a trivial extension which allows this.
目前的实现中只有运行在Erlang shell中的新jobs才能被启动,但这不是一个固有的限制,任意的函数可以在单独创建的进程中运行。在LFE(Lisp风格的Erlang, 一个新的有Lisp语法的Erlang前端语言)中,user_drv模块有一个扩展可以做到。
As Erlang evolved there was the idea that Erlang was, in many ways, like an operating system, not just a language running within an OS. One result of this way of thinking was that in one Erlang system you would want to run many separate applications concurrently. Each application would consist of a number of processes working together but sharing the basic Erlang system. As the applications were separate then there would be general “system” information that would be specific for each application but it should be able to be accessed in a common way.
随着Erlang的进化,在某种程度上它有点像一个操作系统,而不仅仅是运行在OS上的一门语言。这样导致在一个Erlang系统中你可能会想并行的运行许多单独的(互不相干的,separate)应用。每个应用由许多的进程组成,它们一起工作,一起分享基础Erlang系统。由于应用是互不相干的,每个应用应该都会有通用的“系统”信息,虽然每个应用都是特定的,但是每个应用应该能够用一种通用的方式访问。
To address this problem process groups were created. They are not the same as the UNIX concept of the same name. It was decided keep the flat, independent process structure which already existed, and still exists, and not impose a tree structure as exists in UNIX. This means that the process group is a much looser entity and in many ways completely transparent.
为解决这一问题创建了进程组。它们与同名的UNIX概念不同。我们决定保持平坦的(flat)、现有的(而且将来依然存在的)独立的进程结构,而不是像UNIX那样强加一个树形结构。这意味着进程组是一个更松散的实体(entity),在许多方面完全透明。
Each process has a ‘group leader’ which it inherits from the process which spawned it. A process group consists of all the processes which have the same group leader. The group leader is a normal process which has no a priori knowledge of the processes in its group. A process can change group simply by setting its ‘group leader’ to another process.
每个进程都有一个进程组组长(group leader),它从创建此进程的进程继承而来。一个进程组由所有有着相同group leader的进程组成。group leader是一个普通的进程,对它组里的进程它预先并没有太多的了解。一个进程可以改变它的组,只需简单的将它的group leader设置为另一进程即可。
Processes could then communicate with the group leader to get the process group’s common data.
进程可以与group leader通讯以获取进程组的共同数据。
There was much system information which could be “specialised” in this way; two obvious ones are default i/o streams and current working directory. Unfortunately this feature was never used to its full extent and is now only used for default i/o, the standard group leader process is an i/o-server process. Two reasons for it not being used is that the idea of running multiple applications on one Erlang system is not the common use (correct me if I am wrong) and the general lack of knowledge of the feature (again, correct me I am wrong).
采用这种方式会有许多系统信息成为特别(specialised)信息。最显而易见的两个是缺省I/O流和当前工作路径。不幸的是,此特征现在只在缺省I/O中用到,一个标准的group leader进程例子是I/O服务器进程。没有这样做有两个原因:在一个Erlang系统中运行多个应用并不常见(如果俺错了请帮忙指出);普遍缺乏对特征的了解(再次的,如果俺错了请帮忙指出)。
It would be good to have some example programs that illustrate this ☺
这里最好有些例子程序说明这点。
Using process groups it is very easy for different applications to have different default i/o channels. For example some could be communicating through separate windows, some directly to a file and some over TCP to another system (a browser interface to Erlang).
通过使用进程组可以非常容易的使不同的应用有不同的缺省I/O通道。例如,一些应用可以通过独立的窗口(windows)通信,一些应用可以直接访问一个文件,一些应用可以通过TCP连接到其它系统(一个对Erlang的浏览器接口???)。
One problem with running multiple applications concurrently is that if more than one is communicating with the user through the same channel then the i/o will become very jumbled.
并行的运行多个应用会有一个问题:如果有超过一个的应用通过相同的通道与用户通讯,I/O将变得非常混乱。
The solution to this was to introduce the concept of a ‘job’ and a user driver which controls which job is currently connected to, and hence communicating with, the user. A job is a process group together with its group leader. The user driver communicates the job through its group leader. Within the user driver you can start new jobs both locally and remotely, kill jobs and change which job is connected to the user. The i/o from jobs which are not connected is buffered (simply by not receiving it) until another job is connected and its i/o sent to the user. Controlling jobs in the user driver is done with JCL(Job Control Language).
解决办法是引进job和用户驱动器(user driver)的概念,user driver用来控制当前正在连接的是哪个job(以及正在与哪个用户通讯)。一个job是一个进程组及其group leader。user driver通过job的group leader与该job通信。在user driver内,你可以在本地也可以远程的启动新的jobs,或者杀掉jobs,以及修改由哪个job连接到用户。来自jobs的还没连接的I/O会被缓冲(通过不接受它),直到另一个job连接上,它的I/O会被发送给用户。通过JCL可以在user driver内控制jobs。
In the current implementation only new jobs running Erlang shells can be started but this is not an inherent limitation, any function could be spawned instead. In LFE(Lisp Flavoured Erlang, a new front end to Erlang with Lisp syntax) the user_drv module has a trivial extension which allows this.
目前的实现中只有运行在Erlang shell中的新jobs才能被启动,但这不是一个固有的限制,任意的函数可以在单独创建的进程中运行。在LFE(Lisp风格的Erlang, 一个新的有Lisp语法的Erlang前端语言)中,user_drv模块有一个扩展可以做到。
发表评论
-
NIF与OS线程
2013-08-31 01:29 1104NIF的OS线程编程模型可以参考The Art of Mult ... -
关于nif
2013-08-19 10:28 5100一、NIF的误用问题 使用NIF是很危险的,一不小心它就会搞 ... -
遇到的riak性能问题
2013-07-23 10:59 24111。 遇到一个奇怪的性能问题,多个进程中用riakc_pb_ ... -
folsom_metrics使用备忘
2013-06-07 15:41 1475folsom是一个通用的统计度量工具。使用很简单,关键是搞清它 ... -
Riak Core与folsom
2012-09-01 11:54 1493folsom是Riak从1.2开始引入。 -
关于Erlang/OTP的application参数配置
2012-08-26 23:27 9125Erlang/OTP中将完成特定功能的一组模块组织起来,称之 ... -
rebar工具使用备忘录 (5)
2012-08-23 18:17 1493haogongju、人人IT网、59n南龙、360doc、as ... -
lager的使用
2012-08-23 15:06 10546haogongju、人人IT网、59n南龙、360doc不要抄 ... -
rebar工具使用备忘录 (4)
2012-08-22 19:20 5614haogongju、人人IT网、59n南龙、360doc、as ... -
rebar工具使用备忘录 (3)
2012-08-22 19:18 1305haogongju、人人IT网、59n南龙、360doc不要抄 ... -
对Riak Core的探索 (9) cheatsheet
2012-08-12 12:58 1673haogongju、人人IT网、59n南龙、360doc不要抄 ... -
对Riak Core的探索 (8)
2012-08-11 18:52 1255haogongju、人人IT网、59n南龙、360doc不要抄 ... -
关于webmachine
2012-08-03 14:38 2818haogongju、人人IT网、59n ... -
使用dialyzer遇到的问题
2012-06-19 18:18 11941. 对自定义behaviour的警告 有洁癖的可能无法忍受这 ... -
关于erlang的iolist
2012-06-17 15:10 2822erlang字符串可以用list结构存放ASCII编码(0~2 ... -
关于erlang的binary
2012-06-02 16:03 73291. binary数据是可以在不 ... -
关于erlang的进程池
2012-05-30 18:42 6130有两种情况需要考虑使 ... -
riak对大数据文件或对象的支持问题
2012-05-24 19:24 1568很遗憾在2011年12月的时 ... -
riak资料汇编
2012-04-10 17:38 2543一、上手 各个操作系统平台上的安装说明:Installati ... -
对riak_core的探索 (5)
2012-04-05 17:31 0Coordinator的使用 一份partition有多个副 ...
相关推荐
2. **分布式特性**:Erlang的分布式节点通信,分布式数据管理,以及如何在多台机器上部署和运行Erlang应用。 3. **故障恢复与容错**:Erlang的错误处理模式,如监控树(supervision trees)和故障检测,以及如何...
作为“源码软件”,Erlang 25.0同样提供了源代码,开发者可以深入研究其内部工作原理,进行定制化开发,或者为Erlang社区贡献代码。对于开发者而言,理解Erlang的源码可以帮助他们更好地利用这个平台,实现更高效、...
Erlang OTP设计原理是一份深入探讨Erlang/OTP(Open Telecom Platform)框架中设计模式和组织代码原则的文档。Erlang OTP作为Erlang语言的中间件平台,提供了构建可扩展和容错系统的标准方法。 文档开篇就介绍了...
- **第4章:函数式编程** —— 讲解函数式编程的基本原理及其在Erlang中的应用。 - **第5章:进程与并发** —— 详细介绍Erlang的进程模型和并发机制。 - **第6章:错误处理与容错** —— 讨论如何有效地处理错误和...
【Erlang高级应用和原理】深入探讨 Erlang是一种高级编程语言,以其在并发处理、分布式计算和容错性方面的强大能力而闻名。它在国内和国外都有多个成功的应用案例,例如校内的广告平台、Sohu的白社会、阿里巴巴的...
Port Driver 在 Erlang 中的工作原理如下: 1. **创建端口**:Erlang 进程可以通过 `open_port/2` 函数创建一个新的端口,并指定端口的选项,如可执行文件路径、环境变量等。 2. **数据传输**:Erlang 进程通过端口...
**Erlang B模型**是通信工程领域中的一个重要概念,特别是在无线通信系统设计中用于评估系统容量...通过深入研究"Erlang_B_model.pdf",读者可以更全面地了解这一模型的原理和应用,从而提升在通信工程领域的专业素养。
Erlang 高级原理和应用 并行编程 脚本语言
Erlang/OTP 17 [erts-6.0] [64-bit] [smp:2:2] Eshell V6.0 (abort with ^G) 1> ``` - **退出Erlang Shell**:输入`halt()`命令退出。 **1.2 Building and Installing Erlang/OTP** - **介绍**:这部分介绍了...
Erlang OTP是Erlang编程...理解Erlang OTP的特性和RabbitMQ的工作原理,能够帮助开发者更好地利用这些工具构建高效、可靠的系统。在实际操作中,遵循正确的安装步骤,并深入学习相关知识,将有助于提升开发和运维效率。
这份"Erlang游戏程序学习完整PDF手册"是一份全面介绍Erlang在游戏开发中应用的学习资料,包含了Erlang的基础知识、并发原理以及在游戏开发中的实践案例。 Erlang语言的设计理念源自于Ericsson公司为解决电信系统中...
- **基础准备**: 如果之前没有接触过任何编程语言,建议先学习一些基础知识,如 C 语言或 Python,了解计算机的基本工作原理和编程思维。 - **官方资源**: 通过阅读《Programming Erlang》这本书来深入了解 Erlang ...
同时,了解Erlang OTP的基本概念和RabbitMQ的工作原理,有助于更好地利用这两个工具解决实际问题。 总结来说,Erlang 25.2.3和RabbitMQ Server 3.11.9是用于构建高效、可靠的分布式消息系统的重要工具,尤其在Java...
2. **故障恢复与容错**:Erlang支持热代码替换,可以在运行时更新代码而不会中断服务。此外,进程之间独立运行,一个进程的崩溃不会影响其他进程,这使得Erlang系统具有很高的容错性。 3. **函数式编程**:Erlang是...
Erlang深度分析所包含的内容非常广泛,涵盖了从Erlang虚拟机的工作原理、性能优化、最佳编程实践,到最新的Erlang版本中新增特性的介绍。Erlang语言因其独特的并发模型、高效的分布式计算能力和灵活的网络编程接口,...
Erlang OTP 设计原理涉及到的核心概念包括监督树、行为模式以及应用的设计和管理。Erlang/OTP 提供了一种组织代码的高级原则,它基于进程、模块和目录的层次结构来构建可靠的、可容错的分布式系统。本文档将详细介绍...
通过这个"erlang nif test"项目,你可以深入理解Erlang NIF的工作原理,学习如何在Erlang和C之间进行高效的通信,以及如何在Erlang环境中编写和测试高性能代码。这是一个很好的实践平台,对于想要提升Erlang应用性能...
2. **BEAM虚拟机** BEAM是Erlang虚拟机的缩写,它是Erlang程序运行的基础。BEAM虚拟机执行Erlang字节码,提供了垃圾回收、内存管理等功能。在源码中,你可以找到关于字节码解释器、垃圾收集算法的实现。 3. **模块...
### Erlang VM (Erlang虚拟机)深入解析 #### Erlang简介 Erlang是一种通用、并发、强容错的编程语言,最初由...通过深入了解Erlang VM的工作原理及其特性,我们可以更好地利用其优势来设计和实现高效可靠的系统。
Erlang是一种面向并发的、函数式编程语言,由瑞典电信设备制造商Ericsson...通过深入学习,你不仅可以掌握一门独特的编程语言,还能理解并发编程和分布式系统的底层原理,这对于任何IT专业人员来说都是一项宝贵的技能。