How can multiple process access STDIN,STDOUT at the same time. And each of them has its own instances running independently without causing problem in other process i/o ?
STDIN and STDOUT are just aliases for I/O streams. Each process has its own STDIN and STDOUT.
However, it is possible for two processes to have their own STDIN and STDOUT mapped to the same stream. The results are bizarre.
Try running multiple programs in the background that read from and write to the console.
The way the system avoids chaos is through system protection. A normal user cannot run a program from a terminal that reads and writes to someone else's terminal.
But, if you want to screw yourself up by running multiple programs that read from and write to YOUR console/terminal, the system does not protect you from yourself.
STDIN/STDOUT are nothing but the file descriptors and each process would have its own FD.
Below discussions would beef help for you:
https://unix.stackexchange.com/questions/96724/how-can-a-command-have-more-than-one-output
https://unix.stackexchange.com/questions/31334/what-is-meant-by-connecting-stdout-and-stdin/31339#31339
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With