Does the shell allocates a job ID to all processes(foreground and background)?
jobs
command shows the existing background jobs. How do we see job ID of foreground process?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.What is the maximum value of a job ID?
views:
96answers:
2
+2
A:
Job control is a shell feature, not an OS level feature such as processes are.
Job identifiers are assigned when job control is invoked, e.g. with suspend-character (usually Ctrl-Z) or by issuing an
&
ampersand at the end of command line.Foreground process gets a job ID only when you suspend it. The shell outputs the job ID for you when suspending.
You can't, since you're not working in the shell anymore.
I'd suspect you run out of other resources first before running out of job IDs.
laalto
2009-10-02 12:11:54
A:
Job id is differnt from the process and parent process id. The above definion is not much clearly explained aoubt the job id
susai
2009-11-17 23:25:25