且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Unix 中的作业和进程有什么区别?

更新时间:2022-06-19 01:39:14

作业是由 shell 启动的进程.shell 在作业表中跟踪这些.作业命令显示活动后台进程的列表.他们得到一个 jobspec 编号,它不是进程的 pid.像 fg 这样的命令使用 jobspec id.

Jobs are processes which are started by a shell. The shell keeps track of these in a job table. The jobs command shows a list of active background processes. They get a jobspec number which is not the pid of the process. Commands like fg use the jobspec id.

本着 Jürgen Hötzel 示例的精神:

In the spirit of Jürgen Hötzel's example:

find $HOME | sort &
[1] 15317
$ jobs
[1]+  Running                 find $HOME | sort &
$ fg
find $HOME | sort
  C-c C-z
[1]+  Stopped                 find $HOME | sort
$ bg 1
[1]+ find $HOME | sort &

自己尝试示例并查看手册页.

Try the examples yourself and look at the man pages.