Shouldn't the standard input for different process unique? If so, shouldn't the path of the stdin file be like /dev/pid/stdin instead of a global /dev/stdin?
Does anyone have ideas about this?
/dev/stdin is unique because
- it is a symbolic link to
/proc/self/fd/0 /proc/selfis a symbolic link only seen by your running process to its process-id
The /proc filesystem is a virtual (not real) filesystem which has the ability to show a different view to each process.
Further reading:
来源:https://stackoverflow.com/questions/36615360/in-linux-why-is-there-a-global-dev-stdin-file-for-all-processes