本文介绍了向两个命令之间的管道添加大缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下形式的bash命令行

Given a bash command line of the form

commandA | commandB

我想添加一个大小为〜1MB的缓冲区,该缓冲区位于commandAcommandB之间.我希望能够以某种形式做到这一点

I want to add a buffer of size ~1MB that sits between commandA and commandB.I would expect to be able to do this with something of the form

commandA | BUFFER | commandB

但是用于BUFFER的命令是什么?

but what is the command to use for BUFFER?

备注:我想这样做是为了使两个命令解耦,以使它们更好地并行化.问题在于commandB以大块处理数据,这当前意味着commandA阻塞,直到commandB用块完成.所以一切都按顺序运行:-(

Remark: I want to do this in order to decouple the two commands to make them parallelize better. The problem is that commandB processes data in large chunks, which currently means that commandA blocks until commandB is done with a chunk. So everything runs sequentially :-(

推荐答案

BUFFER称为缓冲区. (第1个缓冲区,也许在apt-get安装缓冲区之后)

BUFFER is called buffer. (man 1 buffer, maybe after apt-get install buffer)

这篇关于向两个命令之间的管道添加大缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:01