并发计算的示例问题

发布于 2024-09-15 02:07:42 字数 321 浏览 12 评论 0原文

当今使用的并发编程范例和方法有很多。软件事务内存、参与者、共享状态并发、元组空间等等。

然而,我发现缺少的是一个有趣的并发测试问题库。一个众所周知的例子是“哲学家就餐问题”,它既不够复杂,又不够激励人心,也不现实。还有许多并行算法(矩阵乘法、渲染、一般嵌套数据并行)只需要分配工作,但在执行线程之间没有真正的并发通信。

那么,任何人都可以向我指出一些有趣的问题,这些问题需要在交互式甚至分布式环境中实现真正的并发,并且足够简单,可以用作并发范例的示例?理想情况下,我想找到一组问题作为并发范例的“缺乏测试”(或突出它们的差异,因为每个范例都有其优点和缺点)。

非常感谢任何帮助:)

There's a plethora of paradigms and methods for concurrent programming in use today. Software transactional memory, actors, shared state concurrency, tuple spaces and many, many more.

What I find lacking, however, is a library of interesting test problems for concurrency. One well known example is the "Dining Philosophers Problem", which is neither a complex enough nor motivating nor realistic one. Then there are many parallel algorithms (matrix multiplication, rendering, general nested data parallelism) that just require distribution of work, but no real concurrency with communication between threads of execution.

So, can anyone point me to some interesting sets of problems that require real concurrency in an interactive, perhaps even distributed environment, that are simple enough to use as examples for concurrency paradigms? Ideally, I want to find a set of problems to serve as a "lackmus-test" for concurrency paradigms (or to highlight their differences, as every paradigm has its strengths and weaknesses).

Any help is much appreciated :)

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

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

发布评论

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

评论(1

°如果伤别离去 2024-09-22 02:07:42

我之前已经考虑过这个确切的问题,之前我自己提出了一些并发编程范例 :p

然后我得出的结论是,这样的测试集似乎并不真正以独立于语言的方式存在。虽然它的存在可能会有帮助,但似乎有一些相当充分的理由它不存在(据我所知)。

并发编程的大部分焦点往往集中在数据并行性上,即相同的操作并行地应用于同一数据集的不同部分。我认为您正在谈论的任务级并行性(即并行执行不同的任务,可能共享数据)实际上并没有做太多。我想这是因为它有点难。但我认为这也有点困难,因为大多数问题并不特别适合这种并发性。用并发原语描述分布式系统可能会有所帮助,但这些系统往往是解耦的,因此有一个协议(书面的或隐含的)来调节它们的通信。人们往往不会将这些类型的系统视为明显的“并发”编程情况,即使它们是在正确的框架内查看的(即,将“客户端”和“服务器”视为在某些点上并行操作并同步的代理) 。

我认为您唯一能找到灵感来源的地方是在个人实现中。 Erlang、Occam(和 Occam-pi)、Alice、CML、Concurrent Haskell 等都可能有小型测试语料库,但问题及其实现都将偏向于在特定语言中实现(因为它们显然是可以用该语言实现!)。也许您还可以查看致力于多方会话类型,以及各种过程演算,例如 pi 演算、CCS 和 CSP,看看有哪些类型他们使用的系统作为示例模型。用于描述并发通信系统的一组与语言无关的标准问题的想法很有吸引力,但我认为目前有些难以捉摸。

I've previously considered this exact issue, having previously proposed some concurrent programing paradigms myself :p

The conclusion I reached then is that such a test set doesn't seem to really exist in a language-independent manner. While it might be helpful for it to exist, there seem to be some fairly good reasons it doesn't (to the best of my knowledge).

Most of the focus within concurrent programming tends to be on data parallelism, such that the same operation is applied in parallel to different pieces of the same data set. The kinds of task-level parallelism (i.e. different tasks being performed in parallel, possibly sharing data) that I think you're talking about is actually not done very much. I think this is because it's kinda hard. But I think it's also kinda hard because most problems don't lend themselves particularly well to this kind of concurrency. Describing a distributed system in terms of concurrency primitives may be helpful, but these systems tend to be decoupled such that there is a protocol (written or implied) moderating their communication. People tend not to think of these kinds of systems as obviously "concurrent" programming situations, even though they are when viewed within the right frame (i.e. considering the "client" and "server" as agents operating in parallel with synchronisation at some points).

The only places I think you could find some sources of inspiration would be within individual implementations. Erlang, Occam (and Occam-pi), Alice, CML, Concurrent Haskell etc all are likely to have small test corpuses, but both the problems and their implementations are going to be biased towards being implementable within a specific language (because they obviously are implementable within that language!). Perhaps you could also look to the communities working on multi-party session types, and various process calculi such as pi-calculus, CCS and CSP to see what kinds of systems they are using as example models. The idea of a standard language-agnostic set of problems for describing concurrent communicating systems is appealing, but somewhat elusive at this point, I think.

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