What does TTY mean in the unix ps command?

坚强是说给别人听的谎言 提交于 2019-12-03 10:39:09

问题


When I run PS one of the columns output is TTY. What does this mean? In particular, how does as value of "??" compare with "ttys000"?

I ask because I have a Java program execute sort via ProcessBuilder, and when this program is run via my IDE (IntelliJ) the process takes 5x less than when run as an executable jar outside the IDE.

In each case I run ps when the sort is running and the only difference is the IDE creats a process with a TTY of ?? whereas the jar creates a process with TTY of ttys000.


回答1:


A TTY is a computer terminal. In the context of ps, it is the terminal that executed a particular command.

The abbreviation stands for "TeleTYpewriter", which were devices that allowed users to connect to early computers.

In relation to your situation, the jar creates a virtual terminal named 'ttys000' but the IDE does not attach to a virtual terminal to execute the command.




回答2:


A process can be (and usually is) bound to a "controlling terminal". This terminal may be hardware at the end of a serial line, or much more likely today, be a virtual software equivalent. The TTY is inherited from the parent process. Most likely your IDE disassociates itself from its TTY, and when started outside your java program inherits your shell's TTY.



来源:https://stackoverflow.com/questions/7113770/what-does-tty-mean-in-the-unix-ps-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!