'Is it possible to limit the number of lines in a linux pipeline?

I have a bash pipeline. I would like to stop too much work being by the earlier workers before the later workers have processed it. Is there a way to decrease the amount data that can be stored in a pipe and I can I specify this limit in lines rather than bytes?

I'm aware that the "correct" way of doing this would be to use a message passing system -but that seems like a bunch of overhead.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source