Does kernel sending SIGHUP to a process group that becomes orphaned and contains a stopped process terminate...
In The Linux Programming Interface
To see why orphaned process groups are important, we need to view
things from the perspective of shell job control. Consider the
following scenario based on Figure 34-3:
Before the parent process exits, the child was stopped (perhaps because the parent sent it a stop signal).
When the parent process exits, the shell removes the parent’s process group from its list of jobs. The child is adopted by init and
becomes a background process for the terminal. The process group
containing the child is orphaned.
At this point, there is no process that monitors the state of the stopped child via wait().
Since the shell did not create the child process, it is not aware of
the child’s existence or that the child is part of the same process
group as the deceased parent. Furthermore, the init process checks
only for a terminated child, and then reaps the resulting zombie
process. Consequently, the stopped child might languish forever, since
no other process knows to send it a SIGCONT signal in order to cause
it to resume execution.
Even if a stopped process in an orphaned process group has a
still-living parent in a different session, that parent is not
guaranteed to be able to send SIGCONT to the stopped child. A
process may send SIGCONT to any other process in the same session,
but if the child is in a different session, the normal rules for
sending signals apply (Section 20.5), so the parent may not be able to
send a signal to the child if the child is a privileged process that
has changed its credentials.
To prevent scenarios such as the one described above, SUSv3 specifies
that if a process group becomes orphaned and has any stopped members,
then all members of the group are sent a SIGHUP signal, to inform
them that they have become disconnected from their session, followed
by a SIGCONT signal, to ensure that they resume execution. If the
orphaned process group doesn’t have any stopped members, no signals
are sent.
The default action to SIGHUP is termination. So does kernel implicitly sending SIGHUP to a process group that becomes orphaned and contains a stopped process mean that
those processes in the group and without their own SIGHUP dispositions will be terminated? Will any stopped process in the group be first resumed by SIGCONT and terminated by SIGHUP?
to make the processes in the group survive, they need to have their own SIGHUP dispositions or ignore SIGHUP?
Thanks.
linux process-groups sighup
add a comment |
In The Linux Programming Interface
To see why orphaned process groups are important, we need to view
things from the perspective of shell job control. Consider the
following scenario based on Figure 34-3:
Before the parent process exits, the child was stopped (perhaps because the parent sent it a stop signal).
When the parent process exits, the shell removes the parent’s process group from its list of jobs. The child is adopted by init and
becomes a background process for the terminal. The process group
containing the child is orphaned.
At this point, there is no process that monitors the state of the stopped child via wait().
Since the shell did not create the child process, it is not aware of
the child’s existence or that the child is part of the same process
group as the deceased parent. Furthermore, the init process checks
only for a terminated child, and then reaps the resulting zombie
process. Consequently, the stopped child might languish forever, since
no other process knows to send it a SIGCONT signal in order to cause
it to resume execution.
Even if a stopped process in an orphaned process group has a
still-living parent in a different session, that parent is not
guaranteed to be able to send SIGCONT to the stopped child. A
process may send SIGCONT to any other process in the same session,
but if the child is in a different session, the normal rules for
sending signals apply (Section 20.5), so the parent may not be able to
send a signal to the child if the child is a privileged process that
has changed its credentials.
To prevent scenarios such as the one described above, SUSv3 specifies
that if a process group becomes orphaned and has any stopped members,
then all members of the group are sent a SIGHUP signal, to inform
them that they have become disconnected from their session, followed
by a SIGCONT signal, to ensure that they resume execution. If the
orphaned process group doesn’t have any stopped members, no signals
are sent.
The default action to SIGHUP is termination. So does kernel implicitly sending SIGHUP to a process group that becomes orphaned and contains a stopped process mean that
those processes in the group and without their own SIGHUP dispositions will be terminated? Will any stopped process in the group be first resumed by SIGCONT and terminated by SIGHUP?
to make the processes in the group survive, they need to have their own SIGHUP dispositions or ignore SIGHUP?
Thanks.
linux process-groups sighup
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it).
– mosvy
10 hours ago
add a comment |
In The Linux Programming Interface
To see why orphaned process groups are important, we need to view
things from the perspective of shell job control. Consider the
following scenario based on Figure 34-3:
Before the parent process exits, the child was stopped (perhaps because the parent sent it a stop signal).
When the parent process exits, the shell removes the parent’s process group from its list of jobs. The child is adopted by init and
becomes a background process for the terminal. The process group
containing the child is orphaned.
At this point, there is no process that monitors the state of the stopped child via wait().
Since the shell did not create the child process, it is not aware of
the child’s existence or that the child is part of the same process
group as the deceased parent. Furthermore, the init process checks
only for a terminated child, and then reaps the resulting zombie
process. Consequently, the stopped child might languish forever, since
no other process knows to send it a SIGCONT signal in order to cause
it to resume execution.
Even if a stopped process in an orphaned process group has a
still-living parent in a different session, that parent is not
guaranteed to be able to send SIGCONT to the stopped child. A
process may send SIGCONT to any other process in the same session,
but if the child is in a different session, the normal rules for
sending signals apply (Section 20.5), so the parent may not be able to
send a signal to the child if the child is a privileged process that
has changed its credentials.
To prevent scenarios such as the one described above, SUSv3 specifies
that if a process group becomes orphaned and has any stopped members,
then all members of the group are sent a SIGHUP signal, to inform
them that they have become disconnected from their session, followed
by a SIGCONT signal, to ensure that they resume execution. If the
orphaned process group doesn’t have any stopped members, no signals
are sent.
The default action to SIGHUP is termination. So does kernel implicitly sending SIGHUP to a process group that becomes orphaned and contains a stopped process mean that
those processes in the group and without their own SIGHUP dispositions will be terminated? Will any stopped process in the group be first resumed by SIGCONT and terminated by SIGHUP?
to make the processes in the group survive, they need to have their own SIGHUP dispositions or ignore SIGHUP?
Thanks.
linux process-groups sighup
In The Linux Programming Interface
To see why orphaned process groups are important, we need to view
things from the perspective of shell job control. Consider the
following scenario based on Figure 34-3:
Before the parent process exits, the child was stopped (perhaps because the parent sent it a stop signal).
When the parent process exits, the shell removes the parent’s process group from its list of jobs. The child is adopted by init and
becomes a background process for the terminal. The process group
containing the child is orphaned.
At this point, there is no process that monitors the state of the stopped child via wait().
Since the shell did not create the child process, it is not aware of
the child’s existence or that the child is part of the same process
group as the deceased parent. Furthermore, the init process checks
only for a terminated child, and then reaps the resulting zombie
process. Consequently, the stopped child might languish forever, since
no other process knows to send it a SIGCONT signal in order to cause
it to resume execution.
Even if a stopped process in an orphaned process group has a
still-living parent in a different session, that parent is not
guaranteed to be able to send SIGCONT to the stopped child. A
process may send SIGCONT to any other process in the same session,
but if the child is in a different session, the normal rules for
sending signals apply (Section 20.5), so the parent may not be able to
send a signal to the child if the child is a privileged process that
has changed its credentials.
To prevent scenarios such as the one described above, SUSv3 specifies
that if a process group becomes orphaned and has any stopped members,
then all members of the group are sent a SIGHUP signal, to inform
them that they have become disconnected from their session, followed
by a SIGCONT signal, to ensure that they resume execution. If the
orphaned process group doesn’t have any stopped members, no signals
are sent.
The default action to SIGHUP is termination. So does kernel implicitly sending SIGHUP to a process group that becomes orphaned and contains a stopped process mean that
those processes in the group and without their own SIGHUP dispositions will be terminated? Will any stopped process in the group be first resumed by SIGCONT and terminated by SIGHUP?
to make the processes in the group survive, they need to have their own SIGHUP dispositions or ignore SIGHUP?
Thanks.
linux process-groups sighup
linux process-groups sighup
asked 11 hours ago
Tim
25.6k74245449
25.6k74245449
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it).
– mosvy
10 hours ago
add a comment |
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it).
– mosvy
10 hours ago
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it).
– mosvy
10 hours ago
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it).
– mosvy
10 hours ago
add a comment |
1 Answer
1
active
oldest
votes
Please let me turn mosvy's comment into an answer:
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490494%2fdoes-kernel-sending-sighup-to-a-process-group-that-becomes-orphaned-and-contains%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please let me turn mosvy's comment into an answer:
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it)
add a comment |
Please let me turn mosvy's comment into an answer:
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it)
add a comment |
Please let me turn mosvy's comment into an answer:
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it)
Please let me turn mosvy's comment into an answer:
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it)
answered 10 hours ago
community wiki
Tim
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490494%2fdoes-kernel-sending-sighup-to-a-process-group-that-becomes-orphaned-and-contains%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Yes & Yes. You can see the Notes in my answer here for link(s) to the linux source implementing that (the comments from the linux source and the actual code are much better than that prose or my glossing over it).
– mosvy
10 hours ago