Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

unix

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

like image 712
Suri Avatar asked Apr 27 '10 05:04

Suri


People also ask

What do you mean by job in Unix?

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.

What is the job in Linux?

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.

What are different classes of jobs in Unix?

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.

What is the difference between job and thread?

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.


4 Answers

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.

like image 174
Eddy Pronk Avatar answered Sep 20 '22 19:09

Eddy Pronk


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 
like image 25
Jürgen Hötzel Avatar answered Sep 23 '22 19:09

Jürgen Hötzel


http://en.wikipedia.org/wiki/Job_control_%28Unix%29:

Processes under the influence of a job control facility are referred to as jobs.

like image 45
Carsten Avatar answered Sep 19 '22 19:09

Carsten


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.

like image 31
Will Avatar answered Sep 21 '22 19:09

Will