How can we find out the job ID of a process in C?

Tags: c unix shell
Question!
  1. Does the shell allocates a job ID to all processes(foreground and background)?

  2. jobs command shows the existing background jobs. How do we see job ID of foreground process?

  3. I want to use a function in C (like getpid()) to get the job ID and status of a given process given the pid of the process.

  4. What is the maximum value of a job ID?



Answers

Job id is different from the process and parent process id. The above definition is not much clearly explained about the job id

By : susai


Job control is a shell feature, not an OS level feature such as processes are.

  1. Job identifiers are assigned when job control is invoked, e.g. with suspend-character (usually Ctrl-Z) or by issuing an

By : laalto


This video can help you solving your question :)
By: admin