1

I don't know what exactly is JID (job ID) and how it is assigned. What is it's relation to PID and how does one number affect the size of the other in any way?

closed as unclear what you're asking by Anthon, jimmij, cuonglm, Networker, Karlson Dec 11 '14 at 14:18

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What's the context? Are you talking about shell jobs? – muru Dec 10 '14 at 19:05
  • 1
    Could you please provide an example of a PID-JID combination? – Abrixas2 Dec 10 '14 at 19:05
  • Yes, I meant shell job – user Dec 10 '14 at 20:03
1

There are no relations between a PID and a job ID on shells I have used (bash, dash and zsh).

However, a shell job is a child process of the shell, whereas PID 1 (init) is the ancestor of all processes, including the shell. Therefore a process with job id 1 will always have a PID greater than the job ID.

The assignment of a job ID depends on the shell. On bash, usually the job ID assigned is one greater than the greatest job ID of a running background job:

$ sleep 1 & sleep 10 & sleep 1 &
[1] 11367
[2] 11370
[3] 11373
$ 
[1]   Done                    sleep 1
[3]+  Done                    sleep 1
$ sleep 1 &
[3] 11378

Not the answer you're looking for? Browse other questions tagged or ask your own question.