Whenever process is printing heavily on the stdout, if I try to kill process via sending signal "ctrl + c", the process does not stop immediately. But if I am redirecting output in the file, process stops immediately if I press "ctrl +c". Infact If I am using gnu screen, and my process is outputting heavily on stdout, then I am not able to switch the tab as as well. Why is such behavior

  • 1
    I've always out this down to output buffering. – Iain Dec 21 '15 at 7:49

The process can generate output much faster than the combination of network and screen can display it.

When you hit ctrl-C this key sequence may take some time to reach the server where the process is running due to network congestion caused by all the output; and when the process is killed, it can take significant time before all the output that has already been generated to be sent to the screen because of buffering in various places: firstly the network buffer on the server, packet buffers in transit on e.g. routers, input network queue on the display system, and then the input buffer of ssh / screen / X windows (depending on where you're running screen).

When using screen switching tabs has basically the same problem: the ctrl-AA sequence may be delayed en route to the server, then screen may switch the displayed terminal immediately but this is only visible after everything that is already in the pipeline is displayed on your local system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.