哪些挑战促进了并行/并发架构的使用?

发布于 2024-07-13 09:21:55 字数 574 浏览 7 评论 0原文

我对使用内置并行性/并发性的语言的可能性感到非常兴奋,例如 stackless pythonerlang,并坚信不久之后我们都必须朝这个方向前进 -或者会想要,因为这将是获得可扩展性和性能的好/简单的方法。

然而,我太习惯以线性/串行/OOP/函数的方式思考解决方案,以至于我正在努力以值得使用并发的方式来解决我的任何领域问题。 我怀疑我只需要忘记很多东西,但我想我会问以下问题:

  • 你是否在 stackless 或 erlang 或其他中实现了相当大的东西?
  • 为什么这是一个不错的选择? 这是一个好的选择吗? 你会再做吗?
  • 您的问题的哪些特征意味着并发/并行是正确的?
  • 您是否重新构建了现有问题以利用并发/并行性? 如果
  • 是这样,怎么办?

有谁愿意分享一些经验吗?

I am quite excited by the possibility of using languages which have parallelism / concurrency built in, such as stackless python and erlang, and have a firm belief that we'll all have to move in that direction before too long - or will want to because it will be a good/easy way to get to scalability and performance.

However, I am so used to thinking about solutions in a linear/serial/OOP/functional way that I am struggling to cast any of my domain problems in a way that merits using concurrency. I suspect I just need to unlearn a lot, but I thought I would ask the following:

  • Have you implemented anything reasonably large in stackless or erlang or other?
  • Why was it a good choice? Was it a good choice? Would you do it again?
  • What characteristics of your problem meant that concurrent/parallel was right?
  • Did you re-cast an exising problem to take advantage of concurrency/parallelism? and
  • if so, how?

Anyone any experience they are willing to share?

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

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

发布评论

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

评论(4

野味少女 2024-07-20 09:21:55

过去,当台式机只有一个 CPU 时,并行化仅适用于“特殊”并行硬件。 但现在台式机通常有 2 到 8 个核心,因此现在并行硬件已成为标准。 这是一个很大的区别,因此它不仅涉及哪些问题建议并行性,而且还涉及如何将并行性应用于比以前更广泛的问题集。

为了利用并行性,您通常需要以某些方式重新构建您的问题。 并行性在很多方面改变了游戏环境:

  • 您会遇到数据一致性和锁定问题。 因此,您需要尝试组织您的问题,以便拥有可以由不同线程、进程和计算节点处理的半独立数据结构。
  • 如果并行组件执行其工作的相对顺序影响结果,则并行性还会在计算中引入不确定性。 您可能需要防止这种情况,并定义算法的并行版本,该版本对于不同的调度顺序具有鲁棒性。
  • 当您超越主板内并行性并进入网络/集群/网格计算时,您还会遇到网络带宽、网络故障以及故障计算节点的正确管理等问题。 您可能需要修改您的问题,以便更容易处理网络节点出现故障时部分计算丢失的情况。

in the past when desktop machines had a single CPU, parallelization only applied to "special" parallel hardware. But these days desktops have usually from 2 to 8 cores, so now the parallel hardware is the standard. That's a big difference and therefore it is not just about which problems suggest parallelism, but also how to apply parallelism to a wider set of problems than before.

In order to be take advantage of parallelism, you usually need to recast your problem in some ways. Parallelism changes the playground in many ways:

  • You get the data coherence and locking problems. So you need to try to organize your problem so that you have semi-independent data structures which can be handled by different threads, processes and computation nodes.
  • Parallelism can also introduce nondeterminism into your computation, if the relative order in which the parallel components do their jobs affects the results. You may need to protect against that, and define a parallel version of your algorithm which is robust against different scheduling orders.
  • When you transcend intra-motherboard parallelism and get into networked / cluster / grid computing, you also get the issues of network bandwidth, network going down, and the proper management of failing computational nodes. You may need to modify your problem so that it becomes easier to handle the situations where part of the computation gets lost when a network node goes down.
虐人心 2024-07-20 09:21:55

在我们拥有操作系统之前,构建应用程序的人们会坐下来讨论以下问题:

  • 我们将如何在磁盘上存储数据,
  • 我们将使用什么文件系统结构,
  • 我们的应用程序将与什么硬件一起工作
  • 等等,

操作系统是从“开发人员库”的集合中出现的。

操作系统的美妙之处在于您的未编写的软件具有某些特征,它可以:

  • 与永久存储
  • 网络对话
  • 对话 与在命令行中运行的
  • 批量使用
  • 与 GUI 对话

一旦您转移到操作系统- 你不会回到原来的状态...

Erlang/OTP(即不是Erlang)是一个应用程序系统 - 它运行在两台或更多计算机上。

应用程序系统的美妙之处在于,您的未编写的软件具有某些特征,它可以:

  • 两台机器之间进行故障转移
  • 在集群中的
  • ,等等...

猜猜看,一旦您转移到应用程序系统 - 您就不会再去也不回来...

你不必使用 Erlang/OTP,Google 在他们的应用程序引擎中有一个很好的应用程序系统,所以不要担心语言语法。

在 Erlang/OTP 堆栈而不是 Google App Engine 上构建很可能有很好的商业理由 - 您公司的业务开发人员会为您做出决定。

Before we had operating systems people building applications would sit down and discuss things like:

  • how will we store data on disks
  • what file system structure will we use
  • what hardware will our application work with
  • etc, etc

Operating systems emerged from collections of 'developer libraries'.

The beauty of an operating system is that your UNWRITTEN software has certain characteristics, it can:

  • talk to permanent storage
  • talk to the network
  • run in a command line
  • be used in batch
  • talk to a GUI
  • etc, etc

Once you have shifted to an operating system - you don't go back to the status quo ante...

Erlang/OTP (ie not Erlang) is an application system - it runs on two or more computers.

The beauty of an APPLICATION SYSTEM is that your UNWRITTEN software has certain characteristics, it can:

  • fail over between two machines
  • work in a cluster
  • etc, etc...

Guess what, once you have shifted to an Application System - you don't go back neither...

You don't have to use Erlang/OTP, Google have a good Application System in their app engine, so don't get hung up about the language syntax.

There may well be good business reasons to build on the Erlang/OTP stack not the Google App Engine - the biz dev guys in your firm will make that call for you.

苍景流年 2024-07-20 09:21:55

未来问题将几乎保持不变,但实现的底层硬件正在发生变化。 为了使用它,对象(组件、进程、服务,无论你如何称呼它)之间的通信方式将会改变。 消息将异步发送,无需等待直接响应。 相反,在工作完成后,该过程将给发件人回电并提供答案。 这就像人们一起工作。

我目前正在设计一个基于 Erlang/OTP 的轻量级事件驱动架构。 它被称为 Tideland EAS。 我在这里描述这些想法和原则:http://code.google。 com/p/tideland-eas/wiki/IdeasAndPrinciples。 它还没有准备好,但也许你会明白我的意思。

穆埃

The problems will stay almost the same inf future, but the underlying hardware for the realization is changing. To use this, the way of compunication between objects (components, processes, services, how ever you call it) will change. Messages will be sent asynchronously without waiting for a direct response. Instead after a job is done the process will call the sender back with the answer. It's like people working together.

I'm currently designing a lightweighted event-driven architecture based on Erlang/OTP. It's called Tideland EAS. I'm describing the ideas and principles here: http://code.google.com/p/tideland-eas/wiki/IdeasAndPrinciples. It's not ready, but maybe you'll understand what I mean.

mue

妄想挽回 2024-07-20 09:21:55

Erlang 让你并行地思考问题。 你一秒钟都不会忘记。 过了一段时间你就适应了。 问题不大。 除了解决方案在每个小角落变得平行之外。 所有其他语言都必须进行调整。 要并发。 这感觉不自然。 然后你最终会讨厌你的解决方案。 不好玩。

Erlang 最大的优点是它没有全局垃圾收集。 它永远不会休息。 当你每秒有 10000 次页面浏览时,这一点很重要。

Erlang makes you think of the problem in parallel. You won't forget it one second. After a while you adapt. Not a big problem. Except the solution become parallel in every little corner. All other languages you have to tweak. To be concurrent. And that doesn't feel natural. Then you end up hating your solution. Not fun.

The biggest advantages Erlang have is that it got no global garbage collect. It will never take a break. That is kind of important, when you have 10000 page views a second.

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