What is difference between a job and a process in Unix?

后端 未结 8 1293
别跟我提以往
别跟我提以往 2021-02-02 10:53

What is the difference between a job and a process in Unix ? Can you please give an example ?

相关标签:
8条回答
  • 2021-02-02 11:35

    I think a job is a scheduled process or set of processes, a job always has the notion of schedule, otherwise we could call it a process.

    0 讨论(0)
  • 2021-02-02 11:37

    A Process Group can be considered as a Job. For example you create a background process group in shell:

    $ find $HOME|sort &
    [1] 2668
    

    And you can see two processes as members of the new process group:

    $ ps -p 2668 -o cmd,pgrp 
    CMD                          PGRP
    sort                         2667
    
    
    $ ps -p "$(pgrep -d , -g 2667)" -o cmd,pgrp
    CMD                          PGRP
    find /home/juergen           2667
    sort                         2667
    

    You can can also kill the whole process group/job:

    $ pkill -g 2667
    
    0 讨论(0)
提交回复
热议问题