标题:写Bash时,Job Control 的一点笔记
取消只看楼主
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
结帖率:98.63%
 问题点数:0 回复次数:0 
写Bash时,Job Control 的一点笔记
The processes belonging to a single command are called a process group or job.

Typing C-c sends the signal SIGINT to terminate all the processes in the foreground process group.

When a process is created, it becomes a member of the same process group and session as its parent process. You can put it in another process group using the setpgid function, provided the process group belongs to the same session.

The only way to put a process in a different session is to make it the initial process of a new session, or a session leader, using the setsid function.

The shell must cooperate with the terminal driver using the protocol to control which job can use the terminal at any time.

The shell can give unlimited access to the controlling terminal to only one process group(foreground job) at a time.

The user can stop a foreground job by typing the SUSP character and a program can stop any job by sending it a SIGSTOP signal.

Not all operating systems support job control, you can use the _POSIX_JOB_CONTROL macro to test at compile-time whether the system supports job control.

When a process in a background job tries to read from its controlling terminal, the process group is usually sent a SIGTTIN signal. This normally causes all of the processes in that group to stop. However, if the reading process is ignoring or blocking this signal, then read fails with an EIO error instead.

When a process in a background job tries to write to its controlling terminal, the default behavior is to send a SIGTTOU signal to the process group.

When a controlling process terminates, its terminal becomes free and a new session can be established on it.

When a process group becomes an orphan, its processes are sent a SIGHUP signal. Ordinarily, this causes the processes to terminate.
搜索更多相关主题的帖子: function belonging different single 
2012-08-03 23:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-374674-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.738700 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved