Job id in UNIX doubt

I asked a related question ' Difference between Process Group ID and Job ID in Unix ', but I doubt I haven't answered it. In this answer it was written that the job id is built in the data associated with the shell (the core has nothing to do with this), so foreground / background is the understanding of the shell, but when we do " ps x

", then it appears in statistics as "R+"

or "R"

as main and a background process respectively, but ps

executed by the kernel since the kernel knows the job has returned / foreground.

+2


source to share


2 answers


Job IDs are, of course, shell functions.



However, the operating system has a concept of the current terminal process group identifier, which is also used by the shell to facilitate job management. Processes that have the same process group ID as the current terminal process receive a keyboard signal such as SIGINT and can perform I / O on the terminal. These processes are primary processes. If the process group ID is different, then the process is a background process. The ps command displays +

when a process is a foreground process in this concept. You still don't need to know anything about the performance control implemented by the shell.

+1


source


I would not say that "the kernel has nothing to do with this", since the shell uses routines in the kernel to achieve its goals.



The shell decides whether a process is foreground or background, but the kernel must also be aware of this and can report the state of processes when requested by the shell.

0


source







All Articles