| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 712 人关注过本帖
标题:写Bash时,Job Control 的一点笔记
只看楼主 加入收藏
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
结帖率:98.63%
收藏
 问题点数:0 回复次数:1 
写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
薛天佑
Rank: 1
来 自:陕西
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-1-16
收藏
得分:0 
哈哈
2013-01-16 10:47
快速回复:写Bash时,Job Control 的一点笔记
数据加载中...
 
   



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

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