New answers tagged

1

Unix is a multitasking operating system. It doesn't start ps first or last. It starts all the things in the pipeline in parallel. Some might finish first or start after ps starts, and that's where your race comes from that makes the results slightly non-deterministic. Basically, there is no order of operations here. A pipeline is a data stream, not a ...


3

As Bravo points out, a pipe in Linux is not a file, it is dynamic. So ps -x | grep login will actually start both programs at once, so that one can pitch down the pipe and the other can catch. The reason it is not deterministic, why your contrived example doesn't always show four grep instances, is that an instance may not be started until there is something ...


Top 50 recent answers are included