producer and consumer write/read at same rateBash: How to read one line at a time from output of a...
Why did Windows 95 crash the whole system but newer Windows only crashed programs?
Bouncing map back into its bounds, after user dragged it out
Did Vladimir Lenin have a cat?
Why would anyone ever invest in a cash-only etf?
Move arrows along a contour
Is it possible for a particle to decay via gravity?
How to prevent a single-element caster from being useless against immune foes?
Reading electrical clamp tester higher voltage/amp 400A
Are all French verb conjugation tenses and moods practical and efficient?
Boots or trail runners with reference to blisters?
Can living where Earth magnet ore is abundent provide any protection?
Would people understand me speaking German all over Europe?
What are the cons of stateless password generators?
What language is Raven using for her attack in the new 52?
Why did I lose on time with 3 pawns vs Knight. Shouldn't it be a draw?
Can you continue the movement of a Bonus Action Dash granted by Expeditious Retreat if your Concentration is broken mid-move?
What are these bugs on my milkweed?
How can flights operated by the same company have such different prices when marketed by another?
Unknown indication below upper stave
Why didn't Stark and Nebula use jump points with their ship to go back to Earth?
How do I make my photos have more impact?
How does Asimov's second law deal with contradictory orders from different people?
Was Donald Trump at ground zero helping out on 9-11?
How to efficiently shred a lot of cabbage?
producer and consumer write/read at same rate
Bash: How to read one line at a time from output of a command?How a piped shell programs balance their output/input rates?Is there a way to have a function in my bash script auto run on any command error?Piping contents of multiple files between programs while keeping contents separateHow to grep a program's output but also echo the output normally?Are pipe reads not greater than PIPE_BUF atomic?Determine if producer is outpacing consumer in pipelineHow to end pipe from consumer side and put producer in backgroundAt what point can the consumer in a pipeline slow down the producer?how to keep consumer alive even if producer exits
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I would like create a pipeline where the producer writes at the same rate the consumer reads..for example:
tail -f -n +1 | my_proc
the tail command will write all requested lines to my_proc and my_proc has to handle them all at once basically.
I am wondering if there is some pre-made linux utility that can write to the consumer upon some signal - somehow matching the rate at which the consumer consumes. Something like "my_proc will tell tail to read five more lines and write them out".
I am not sure if something like this exists, if writing myself I guess a unix domain socket connection between the two would best option? If so, not sure how to tell both processes which file to listen to.
bash shell pipe stdio
add a comment |
I would like create a pipeline where the producer writes at the same rate the consumer reads..for example:
tail -f -n +1 | my_proc
the tail command will write all requested lines to my_proc and my_proc has to handle them all at once basically.
I am wondering if there is some pre-made linux utility that can write to the consumer upon some signal - somehow matching the rate at which the consumer consumes. Something like "my_proc will tell tail to read five more lines and write them out".
I am not sure if something like this exists, if writing myself I guess a unix domain socket connection between the two would best option? If so, not sure how to tell both processes which file to listen to.
bash shell pipe stdio
add a comment |
I would like create a pipeline where the producer writes at the same rate the consumer reads..for example:
tail -f -n +1 | my_proc
the tail command will write all requested lines to my_proc and my_proc has to handle them all at once basically.
I am wondering if there is some pre-made linux utility that can write to the consumer upon some signal - somehow matching the rate at which the consumer consumes. Something like "my_proc will tell tail to read five more lines and write them out".
I am not sure if something like this exists, if writing myself I guess a unix domain socket connection between the two would best option? If so, not sure how to tell both processes which file to listen to.
bash shell pipe stdio
I would like create a pipeline where the producer writes at the same rate the consumer reads..for example:
tail -f -n +1 | my_proc
the tail command will write all requested lines to my_proc and my_proc has to handle them all at once basically.
I am wondering if there is some pre-made linux utility that can write to the consumer upon some signal - somehow matching the rate at which the consumer consumes. Something like "my_proc will tell tail to read five more lines and write them out".
I am not sure if something like this exists, if writing myself I guess a unix domain socket connection between the two would best option? If so, not sure how to tell both processes which file to listen to.
bash shell pipe stdio
bash shell pipe stdio
asked 5 mins ago
Alexander MillsAlexander Mills
2,4562 gold badges21 silver badges67 bronze badges
2,4562 gold badges21 silver badges67 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f533253%2fproducer-and-consumer-write-read-at-same-rate%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f533253%2fproducer-and-consumer-write-read-at-same-rate%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown