每个进程都有自己的stdin,stdout和stderr吗? [英] Does every process have its own stdin, stdout and stderr?

查看:63
本文介绍了每个进程都有自己的stdin,stdout和stderr吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个进程都有自己的stdin,stdout和stderr还是只共享1个stdin,1个stdout和1个stderr?我的意思是当然每台计算机通常有1个键盘和1个终端,但这是进程的输入和输入.输出流彼此分离?

Does every process have its own stdin, stdout and stderr or do they just share 1 stdin, 1 stdout and 1 stderr? I mean of course there's generally 1 keyboard and 1 terminal for each computer, but are processes' input & output streams separated form one another?

推荐答案

stdout stdin stderr 只是提供给由操作环境与它的输入和输出进行交互的过程.尽管事实上只有一个键盘(无论如何,在大多数情况下),操作系统还是知道如何决定哪个进程获取当前输入,并将击键传递给该进程的 stdin .同样,尽管只有一个屏幕,但可以将其划分为多个窗口.最后,许多进程的输入和输出都与文件流绑定在一起.操作系统可以让您将多个进程绑定到单个输入或单个输出文件,但是即使在那种情况下,表示进程内部的 stdin stdout 流的对象也会被绑定.独立的:它们将在操作系统中引用相同的对象,并且操作系统将管理其用户之间共享该对象.

stdout, stdin, and stderr are just the abstractions given to the process by the operating environment to interact with its inputs and outputs. Despite the fact that there is only one keyboard (in most cases, anyway) the operating system knows how to decide which process gets the current input, and delivers the keystrokes to the stdin of that process. Similarly, despite there being only one screen, it may be partitioned into several windows. Finally, many processes have their input and output tied to a file stream. Operating systems can let you bind multiple processes to a single input or to a single output file, but even in that case the objects representing stdin and stdout streams inside the process will be separate: they would reference the same object in the operating system, and the OS will manage sharing that object among its users.

这篇关于每个进程都有自己的stdin,stdout和stderr吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆