基于 Agent/Actor 的并发设计的设计模式

发布于 2024-07-14 15:51:37 字数 1431 浏览 9 评论 0原文

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

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

发布评论

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

评论(3

月下凄凉 2024-07-21 15:51:37

即使我无法想出任何好的现实世界例子来为您提供设计
模式直接向上,有几个地方可以开始。

首先是让你的头脑正确地理解这些概念。 一本书有帮助
你这样做是在存在软件错误的情况下构建可靠的分布式系统
由 Erlang 大师 Joe Armstrong 撰写,其中解释了面向并发的编程
以一种非常方便的方式。 它实际上是一个博士学位。 论文,但不要让它吓到你。
与大多数常见的教科书相比,它更容易阅读,而且更令人愉快。

查看实际系统通常意味着您必须了解太多有关实际系统的信息
语言对于评估事物来说也是有意义的。 对于 Erlang,文档
提供设计方法和行为(Erlang speek for 设计模式库)。
这将说明此设置中最常用的设计模式。 还有这些
已被证明可以有效构建大规模系统,即数百万行代码(相当于 Java 等其他语言的 4 到 10 倍)以及在分布式机器集群中的一台机器上运行的数百万个并发进程。
最近的真实系统示例是 Facebook 聊天

对于其他框架,我恐怕无法真正帮助您。

Even if I cannot come up with any good real world examples that provide you with design
patterns straight up, there are a few places to start.

The first is getting your head wrapped properly round the concepts. One book helping
you do this is Making reliable distributed systems in the presence of software errors
written by an Erlang Guru Joe Armstrong where explains Concurrency Oriented Programming
in a very accessible way. It is in fact a Ph.D. thesis, but do not let that scare you.
It is by far easier to read, and pleasant into the bargain, than most common text books.

Looking at actual systems normally means that you have to learn too much about the actual
language for it too make sense just to evaluate things. For Erlang the documentation
provides design methodology and behaviours(Erlang speek for design pattern libraries).
This will illustrate the design patterns most commonly used in this setting. And these
have proved to be effective in building large scale systems, i.e. millions of lines of code (comparable to a factor 4 to 10 of other languages such as Java) and milloins of concurrent processes running on one machine in distributed clusters of machines.
A recent example of a real live system is Facebook Chat.

For the other frameworks I cannot really help you I am afraid.

溺ぐ爱和你が 2024-07-21 15:51:37

“参与者”本身就是并发编程的统一模式(异步消息队列加上用于处理它的执行上下文),但是有许多设计模式可以帮助指定基于代理的系统的方面或元素。 许多最常见的可以在维基百科关于并发模式的文章中找到。 一些亮点:

如果您还没有遇到过它,Akka 您可能会感兴趣——它是一个运行在 JVM 上的“纯粹”事件驱动的 Actor 框架。

An "actor" is itself the unifying pattern for concurrent programming (an asynchronous message queue plus an execution context for processing it), but there are many design patterns which assist in specifying aspects or elements of agent-based systems. Many of the most common can be found in Wikipedia's article on Concurrency Patterns. Some highlights:

If you haven't come across it already, Akka may be of interest to you -- it is a "purely" event-driven actor framework running on the JVM.

浅语花开 2024-07-21 15:51:37

我在这里问了一个类似的问题一些可能有帮助的合理答案。 我正在仔细观察你的。 我还没有找到真正对我有帮助的东西,但我正在积极寻找。

我认为思维转变是迈向并发架构和语言的最大障碍,在这个障碍被破解之前,开发人员将坚持使用易于学习的 MS 风格范例。 为了使其真正成为主流,它需要进入学校并与 C# 和 VB 一起教授。

我对2080程序员问题的回答是“同时”。

I asked a similar question here which had some reasonable answers that may help. I'm watching yours carefully. I haven't yet found something which has really helped me, but I am very actively looking.

I think the mind-shift is the single largest barrier to stepping to concurrent architectures and languages and until that is cracked developers are going to stick with easy to learn MS style paradigms. For it to really become mainstream it needs to find its way into schools and be taught alongside C# and VB.

My answer to the 2080 programmers question is "concurrently".

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