What is the difference between a job and a process in Unix ? Can you please give an example ?
In Unix and Unix-like operating systems, job control refers to control of jobs by a shell, especially interactively, where a "job" is a shell's representation for a process group.
Whats a job in Linux. A job is a process that the shell manages. Each job is assigned a sequential job ID. Because a job is a process, each job has an associated PID.
UNIX career paths include UNIX Engineer, UNIX Administrator, UNIX Systems Engineer, UNIX Infrastructure Administrator, UNIX Analyst Engineer, UNIX Production Support Engineer, Linux Engineer, Linux Admin etc. The next level career path in UNIX area comes as a Senior UNIX Engineer, Senior Unix Systems Admin etc.
A “job” often means a set of processes, while a “task” may mean a process, a thread, a process or thread, or, distinctly, a unit of work done by a process or thread.
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.
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.
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
http://en.wikipedia.org/wiki/Job_control_%28Unix%29:
Processes under the influence of a job control facility are referred to as jobs.
http://en.wikipedia.org/wiki/Job_control_%28Unix%29
Jobs are one or more processes that are grouped together as a 'job', where job is a UNIX shell concept.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With