Multithreading 这种类似流水线的并行化方法有名字吗?

Multithreading 这种类似流水线的并行化方法有名字吗?,multithreading,performance,optimization,Multithreading,Performance,Optimization,最近,我试图优化一个单线程循环,其核心可以归结为 while (true) { a = A(x) b = B(a) c = C(b) } 换句话说,每一步都取决于前一步的结果。每个函数都执行CPU密集型操作 我最终创建了2个队列和2个新线程,并将其解耦,以便原始线程能够完成 /* on existing thread */ while (true) queue1.Enqueue(A(x)) /* on new thread #1 */ while (true) queue

最近,我试图优化一个单线程循环,其核心可以归结为

while (true)
{
   a = A(x)
   b = B(a)
   c = C(b)
}
换句话说,每一步都取决于前一步的结果。每个函数都执行CPU密集型操作

我最终创建了2个队列和2个新线程,并将其解耦,以便原始线程能够完成

/* on existing thread */ while (true) queue1.Enqueue(A(x))
/* on new thread #1 */   while (true) queue2.Enqueue(B(queue1.Dequeue()))
/* on new thread #2 */   while (true) c = B(queue2.Dequeue()))
现在这3个功能可以并行运行,从而更好地利用多核


它看起来很基本,一定有个名字。不过我找不到。它非常类似于它的功能,只是这是一种线程并行化技术。

更彻底的web搜索揭示了它被称为管道并行。这是一个描述性的名称

在上面链接的其中一个页面上,还可以直观地看到该方法:


我想说这是流水线。听起来像是一个相当简单的生产者/消费者设置。@谢谢,你的回答让我更深入地访问了谷歌,我似乎已经找到了答案。