Home Why standard inputs are not mixed in linux?
Reply: 1

Why standard inputs are not mixed in linux?

Spring fancy
Spring fancy Published in 2018-01-12 22:38:53Z

We know that each process has set three descriptors in advance:

0 (stdin), 1 (stdout), 2 (stderr)

Why stdin between different processes are not mixed ? After all, each process has the same descriptor equals to 0. Can anyone explain it ?

ikegami Reply to 2018-01-12 22:44:12Z

Each process has its own set of file descriptors. File descriptor 0 of one process doesn't necessarily reference the same file handle as file descriptor 0 of another process.

Same goes for memory addresses. Because of memory virtualization, each process has its own address space. Different process can use the same address for different purposes.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.25746 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO