Why does the kernel even bother to send SIGKILL?
up vote
6
down vote
favorite
If a program is not allowed to handle or ignore SIGKILL and SIGSTOP, and must immediately terminate, why does the kernel even send the signal to the program? Can't the kernel simply evict the program from the CPU and memory? I assume the kernel would have the ability do directly do this.
kernel signals
New contributor
add a comment |
up vote
6
down vote
favorite
If a program is not allowed to handle or ignore SIGKILL and SIGSTOP, and must immediately terminate, why does the kernel even send the signal to the program? Can't the kernel simply evict the program from the CPU and memory? I assume the kernel would have the ability do directly do this.
kernel signals
New contributor
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
If a program is not allowed to handle or ignore SIGKILL and SIGSTOP, and must immediately terminate, why does the kernel even send the signal to the program? Can't the kernel simply evict the program from the CPU and memory? I assume the kernel would have the ability do directly do this.
kernel signals
New contributor
If a program is not allowed to handle or ignore SIGKILL and SIGSTOP, and must immediately terminate, why does the kernel even send the signal to the program? Can't the kernel simply evict the program from the CPU and memory? I assume the kernel would have the ability do directly do this.
kernel signals
kernel signals
New contributor
New contributor
New contributor
asked 6 hours ago
1026501
312
312
New contributor
New contributor
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
up vote
13
down vote
A process terminated by SIGKILL
never gets to know about it; the kernel deals with everything. (This does mean that some resources can leak.)
However the signal still needs to be delivered, so that other processes can find out how the killed process was terminated. A parent, using wait
, will get the information that the killed process was terminated by SIGKILL
.
1
You said that some resources can leak. How can that happen? Doesn't the kernel keep careful track of all resources currently used by a process?
– 1026501
2 hours ago
3
@1026501 Certain types of resources, like temporary files or SysV shared memory, cannot be cleaned up automatically by the kernel. If the process doesn't get a chance to remove them itself, they'll be left in place on SIGKILL.
– duskwuff
1 hour ago
1
Similarly, a program might own higher-level resources that the kernel does not know about. For example, an application might own an uncommitted database transaction. Eventually, the database server will give up and roll it back (probably shortly after the TCP connection times out), but until that happens, it occupies resources and may even prevent the database server from processing other transactions because of write locks.
– Kevin
15 mins ago
add a comment |
up vote
2
down vote
This answer is partly correct, there is more to do to terminate a process than to free the memory. However a SIGKILL
is not a tap on the shoulder and a request to do something, it is one of the few signals that a process can't ignore or handle. That means that a SIGKILL
is always handled by the kernel's default handler, and this default action, as with most of the signals, is to terminate the process receiving the signal. The user space part of the program won't even see the signal, so there is no request to do something, no cooperation required, and therefor a program can't misbehave upon receiving SIGKILL
, whether by malicious intent or by some programming error. Instead the kernel side of the process will handle the signal and terminate the process. So in a way the kernel is directly terminating the process, by telling another part of the kernel that the process shall be terminated.
From a programming point of view, when the kernel wants to kill a program (which mostly happens because of missing resources, especially not enough free RAM), there are two possibilities, to duplicate the code that does this when a process has to be terminated, or just call a single function to deliver the signal and know that everything necessary to terminate the process will be handled. The second approach is not only less initial work, it means much less work in the long run because the duplicate code doesn't have to be maintained.
add a comment |
up vote
0
down vote
An overview on how signals work, in order to complete the other answers which are very good:
The execution of a process can happen in two modes: in userspace or in kernelspace. When in userspace, the process executes the code of its program whereas in kernelspace, it executes the code of the kernel. Processes run in userspace as much as possible to do their work but enter kernelspace from time to time during their execution when they make a system call (which is necessary for any privileged operation on the hardware or shared resources of the system itself, like reading a file) or when they are interrupted in their execution.
They are two cases in which a signal is handled: when a process returns into userspace after having finished a system call, or when it wakes up from an interruptible sleep and resumes its execution. In both cases, the process is in kernelspace. Before anything else, the kernel checks if some signal is pending for the process and acts upon it. If a handler is defined for the signal for example, it makes the process execute it upon its return into userspace. As you've said yourself, the case of KILL is special because it cannot be captured. So, it's actually a simple case for the kernel: the return to userspace is cancelled and the process is killed right away, its resources freed, etc.
add a comment |
up vote
-2
down vote
A program can have handlers for pretty much any signal but a KILL.
https://stackoverflow.com/a/2541618/10453847
But why does the kernel still send the signal?
– Joshua
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review
– Scott
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
– dhag
15 mins ago
add a comment |
up vote
-3
down vote
Processes on exit perform several cleanup actions like freeing memory, releasing semaphores, closing files, mayhap some statistics, within their process context / environment. Although the kernel could replicate that, it's easier to tap the process on its shoulder and ask it to commit suicide.
5
I’m curious to learn how a process can do anything at all in response toSIGKILL
, unless the kernel is acting on its behalf.
– Stephen Kitt
5 hours ago
2
You are wrong. Processes do not receive a SIGKILL: unix.stackexchange.com/questions/485644/…
– What
3 hours ago
But couldn't a process be so stuck that it cannot even do these actions? Wouldn't a malicious process somehow be able to misbehave and not terminate? It would make much more sense for the kernel to just stop giving the process CPU time as indicated in the link given by @What.
– 1026501
3 hours ago
@1026501 That is exactly what happens. This response is incorrect.
– duskwuff
1 hour ago
@RudiC Wrong!!!
– Greg Schmit
1 hour ago
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',
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
});
}
});
1026501 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f487830%2fwhy-does-the-kernel-even-bother-to-send-sigkill%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
13
down vote
A process terminated by SIGKILL
never gets to know about it; the kernel deals with everything. (This does mean that some resources can leak.)
However the signal still needs to be delivered, so that other processes can find out how the killed process was terminated. A parent, using wait
, will get the information that the killed process was terminated by SIGKILL
.
1
You said that some resources can leak. How can that happen? Doesn't the kernel keep careful track of all resources currently used by a process?
– 1026501
2 hours ago
3
@1026501 Certain types of resources, like temporary files or SysV shared memory, cannot be cleaned up automatically by the kernel. If the process doesn't get a chance to remove them itself, they'll be left in place on SIGKILL.
– duskwuff
1 hour ago
1
Similarly, a program might own higher-level resources that the kernel does not know about. For example, an application might own an uncommitted database transaction. Eventually, the database server will give up and roll it back (probably shortly after the TCP connection times out), but until that happens, it occupies resources and may even prevent the database server from processing other transactions because of write locks.
– Kevin
15 mins ago
add a comment |
up vote
13
down vote
A process terminated by SIGKILL
never gets to know about it; the kernel deals with everything. (This does mean that some resources can leak.)
However the signal still needs to be delivered, so that other processes can find out how the killed process was terminated. A parent, using wait
, will get the information that the killed process was terminated by SIGKILL
.
1
You said that some resources can leak. How can that happen? Doesn't the kernel keep careful track of all resources currently used by a process?
– 1026501
2 hours ago
3
@1026501 Certain types of resources, like temporary files or SysV shared memory, cannot be cleaned up automatically by the kernel. If the process doesn't get a chance to remove them itself, they'll be left in place on SIGKILL.
– duskwuff
1 hour ago
1
Similarly, a program might own higher-level resources that the kernel does not know about. For example, an application might own an uncommitted database transaction. Eventually, the database server will give up and roll it back (probably shortly after the TCP connection times out), but until that happens, it occupies resources and may even prevent the database server from processing other transactions because of write locks.
– Kevin
15 mins ago
add a comment |
up vote
13
down vote
up vote
13
down vote
A process terminated by SIGKILL
never gets to know about it; the kernel deals with everything. (This does mean that some resources can leak.)
However the signal still needs to be delivered, so that other processes can find out how the killed process was terminated. A parent, using wait
, will get the information that the killed process was terminated by SIGKILL
.
A process terminated by SIGKILL
never gets to know about it; the kernel deals with everything. (This does mean that some resources can leak.)
However the signal still needs to be delivered, so that other processes can find out how the killed process was terminated. A parent, using wait
, will get the information that the killed process was terminated by SIGKILL
.
edited 2 hours ago
answered 2 hours ago
Stephen Kitt
161k24358434
161k24358434
1
You said that some resources can leak. How can that happen? Doesn't the kernel keep careful track of all resources currently used by a process?
– 1026501
2 hours ago
3
@1026501 Certain types of resources, like temporary files or SysV shared memory, cannot be cleaned up automatically by the kernel. If the process doesn't get a chance to remove them itself, they'll be left in place on SIGKILL.
– duskwuff
1 hour ago
1
Similarly, a program might own higher-level resources that the kernel does not know about. For example, an application might own an uncommitted database transaction. Eventually, the database server will give up and roll it back (probably shortly after the TCP connection times out), but until that happens, it occupies resources and may even prevent the database server from processing other transactions because of write locks.
– Kevin
15 mins ago
add a comment |
1
You said that some resources can leak. How can that happen? Doesn't the kernel keep careful track of all resources currently used by a process?
– 1026501
2 hours ago
3
@1026501 Certain types of resources, like temporary files or SysV shared memory, cannot be cleaned up automatically by the kernel. If the process doesn't get a chance to remove them itself, they'll be left in place on SIGKILL.
– duskwuff
1 hour ago
1
Similarly, a program might own higher-level resources that the kernel does not know about. For example, an application might own an uncommitted database transaction. Eventually, the database server will give up and roll it back (probably shortly after the TCP connection times out), but until that happens, it occupies resources and may even prevent the database server from processing other transactions because of write locks.
– Kevin
15 mins ago
1
1
You said that some resources can leak. How can that happen? Doesn't the kernel keep careful track of all resources currently used by a process?
– 1026501
2 hours ago
You said that some resources can leak. How can that happen? Doesn't the kernel keep careful track of all resources currently used by a process?
– 1026501
2 hours ago
3
3
@1026501 Certain types of resources, like temporary files or SysV shared memory, cannot be cleaned up automatically by the kernel. If the process doesn't get a chance to remove them itself, they'll be left in place on SIGKILL.
– duskwuff
1 hour ago
@1026501 Certain types of resources, like temporary files or SysV shared memory, cannot be cleaned up automatically by the kernel. If the process doesn't get a chance to remove them itself, they'll be left in place on SIGKILL.
– duskwuff
1 hour ago
1
1
Similarly, a program might own higher-level resources that the kernel does not know about. For example, an application might own an uncommitted database transaction. Eventually, the database server will give up and roll it back (probably shortly after the TCP connection times out), but until that happens, it occupies resources and may even prevent the database server from processing other transactions because of write locks.
– Kevin
15 mins ago
Similarly, a program might own higher-level resources that the kernel does not know about. For example, an application might own an uncommitted database transaction. Eventually, the database server will give up and roll it back (probably shortly after the TCP connection times out), but until that happens, it occupies resources and may even prevent the database server from processing other transactions because of write locks.
– Kevin
15 mins ago
add a comment |
up vote
2
down vote
This answer is partly correct, there is more to do to terminate a process than to free the memory. However a SIGKILL
is not a tap on the shoulder and a request to do something, it is one of the few signals that a process can't ignore or handle. That means that a SIGKILL
is always handled by the kernel's default handler, and this default action, as with most of the signals, is to terminate the process receiving the signal. The user space part of the program won't even see the signal, so there is no request to do something, no cooperation required, and therefor a program can't misbehave upon receiving SIGKILL
, whether by malicious intent or by some programming error. Instead the kernel side of the process will handle the signal and terminate the process. So in a way the kernel is directly terminating the process, by telling another part of the kernel that the process shall be terminated.
From a programming point of view, when the kernel wants to kill a program (which mostly happens because of missing resources, especially not enough free RAM), there are two possibilities, to duplicate the code that does this when a process has to be terminated, or just call a single function to deliver the signal and know that everything necessary to terminate the process will be handled. The second approach is not only less initial work, it means much less work in the long run because the duplicate code doesn't have to be maintained.
add a comment |
up vote
2
down vote
This answer is partly correct, there is more to do to terminate a process than to free the memory. However a SIGKILL
is not a tap on the shoulder and a request to do something, it is one of the few signals that a process can't ignore or handle. That means that a SIGKILL
is always handled by the kernel's default handler, and this default action, as with most of the signals, is to terminate the process receiving the signal. The user space part of the program won't even see the signal, so there is no request to do something, no cooperation required, and therefor a program can't misbehave upon receiving SIGKILL
, whether by malicious intent or by some programming error. Instead the kernel side of the process will handle the signal and terminate the process. So in a way the kernel is directly terminating the process, by telling another part of the kernel that the process shall be terminated.
From a programming point of view, when the kernel wants to kill a program (which mostly happens because of missing resources, especially not enough free RAM), there are two possibilities, to duplicate the code that does this when a process has to be terminated, or just call a single function to deliver the signal and know that everything necessary to terminate the process will be handled. The second approach is not only less initial work, it means much less work in the long run because the duplicate code doesn't have to be maintained.
add a comment |
up vote
2
down vote
up vote
2
down vote
This answer is partly correct, there is more to do to terminate a process than to free the memory. However a SIGKILL
is not a tap on the shoulder and a request to do something, it is one of the few signals that a process can't ignore or handle. That means that a SIGKILL
is always handled by the kernel's default handler, and this default action, as with most of the signals, is to terminate the process receiving the signal. The user space part of the program won't even see the signal, so there is no request to do something, no cooperation required, and therefor a program can't misbehave upon receiving SIGKILL
, whether by malicious intent or by some programming error. Instead the kernel side of the process will handle the signal and terminate the process. So in a way the kernel is directly terminating the process, by telling another part of the kernel that the process shall be terminated.
From a programming point of view, when the kernel wants to kill a program (which mostly happens because of missing resources, especially not enough free RAM), there are two possibilities, to duplicate the code that does this when a process has to be terminated, or just call a single function to deliver the signal and know that everything necessary to terminate the process will be handled. The second approach is not only less initial work, it means much less work in the long run because the duplicate code doesn't have to be maintained.
This answer is partly correct, there is more to do to terminate a process than to free the memory. However a SIGKILL
is not a tap on the shoulder and a request to do something, it is one of the few signals that a process can't ignore or handle. That means that a SIGKILL
is always handled by the kernel's default handler, and this default action, as with most of the signals, is to terminate the process receiving the signal. The user space part of the program won't even see the signal, so there is no request to do something, no cooperation required, and therefor a program can't misbehave upon receiving SIGKILL
, whether by malicious intent or by some programming error. Instead the kernel side of the process will handle the signal and terminate the process. So in a way the kernel is directly terminating the process, by telling another part of the kernel that the process shall be terminated.
From a programming point of view, when the kernel wants to kill a program (which mostly happens because of missing resources, especially not enough free RAM), there are two possibilities, to duplicate the code that does this when a process has to be terminated, or just call a single function to deliver the signal and know that everything necessary to terminate the process will be handled. The second approach is not only less initial work, it means much less work in the long run because the duplicate code doesn't have to be maintained.
answered 2 hours ago
RalfFriedl
5,2673925
5,2673925
add a comment |
add a comment |
up vote
0
down vote
An overview on how signals work, in order to complete the other answers which are very good:
The execution of a process can happen in two modes: in userspace or in kernelspace. When in userspace, the process executes the code of its program whereas in kernelspace, it executes the code of the kernel. Processes run in userspace as much as possible to do their work but enter kernelspace from time to time during their execution when they make a system call (which is necessary for any privileged operation on the hardware or shared resources of the system itself, like reading a file) or when they are interrupted in their execution.
They are two cases in which a signal is handled: when a process returns into userspace after having finished a system call, or when it wakes up from an interruptible sleep and resumes its execution. In both cases, the process is in kernelspace. Before anything else, the kernel checks if some signal is pending for the process and acts upon it. If a handler is defined for the signal for example, it makes the process execute it upon its return into userspace. As you've said yourself, the case of KILL is special because it cannot be captured. So, it's actually a simple case for the kernel: the return to userspace is cancelled and the process is killed right away, its resources freed, etc.
add a comment |
up vote
0
down vote
An overview on how signals work, in order to complete the other answers which are very good:
The execution of a process can happen in two modes: in userspace or in kernelspace. When in userspace, the process executes the code of its program whereas in kernelspace, it executes the code of the kernel. Processes run in userspace as much as possible to do their work but enter kernelspace from time to time during their execution when they make a system call (which is necessary for any privileged operation on the hardware or shared resources of the system itself, like reading a file) or when they are interrupted in their execution.
They are two cases in which a signal is handled: when a process returns into userspace after having finished a system call, or when it wakes up from an interruptible sleep and resumes its execution. In both cases, the process is in kernelspace. Before anything else, the kernel checks if some signal is pending for the process and acts upon it. If a handler is defined for the signal for example, it makes the process execute it upon its return into userspace. As you've said yourself, the case of KILL is special because it cannot be captured. So, it's actually a simple case for the kernel: the return to userspace is cancelled and the process is killed right away, its resources freed, etc.
add a comment |
up vote
0
down vote
up vote
0
down vote
An overview on how signals work, in order to complete the other answers which are very good:
The execution of a process can happen in two modes: in userspace or in kernelspace. When in userspace, the process executes the code of its program whereas in kernelspace, it executes the code of the kernel. Processes run in userspace as much as possible to do their work but enter kernelspace from time to time during their execution when they make a system call (which is necessary for any privileged operation on the hardware or shared resources of the system itself, like reading a file) or when they are interrupted in their execution.
They are two cases in which a signal is handled: when a process returns into userspace after having finished a system call, or when it wakes up from an interruptible sleep and resumes its execution. In both cases, the process is in kernelspace. Before anything else, the kernel checks if some signal is pending for the process and acts upon it. If a handler is defined for the signal for example, it makes the process execute it upon its return into userspace. As you've said yourself, the case of KILL is special because it cannot be captured. So, it's actually a simple case for the kernel: the return to userspace is cancelled and the process is killed right away, its resources freed, etc.
An overview on how signals work, in order to complete the other answers which are very good:
The execution of a process can happen in two modes: in userspace or in kernelspace. When in userspace, the process executes the code of its program whereas in kernelspace, it executes the code of the kernel. Processes run in userspace as much as possible to do their work but enter kernelspace from time to time during their execution when they make a system call (which is necessary for any privileged operation on the hardware or shared resources of the system itself, like reading a file) or when they are interrupted in their execution.
They are two cases in which a signal is handled: when a process returns into userspace after having finished a system call, or when it wakes up from an interruptible sleep and resumes its execution. In both cases, the process is in kernelspace. Before anything else, the kernel checks if some signal is pending for the process and acts upon it. If a handler is defined for the signal for example, it makes the process execute it upon its return into userspace. As you've said yourself, the case of KILL is special because it cannot be captured. So, it's actually a simple case for the kernel: the return to userspace is cancelled and the process is killed right away, its resources freed, etc.
answered 1 hour ago
lgeorget
8,82622450
8,82622450
add a comment |
add a comment |
up vote
-2
down vote
A program can have handlers for pretty much any signal but a KILL.
https://stackoverflow.com/a/2541618/10453847
But why does the kernel still send the signal?
– Joshua
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review
– Scott
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
– dhag
15 mins ago
add a comment |
up vote
-2
down vote
A program can have handlers for pretty much any signal but a KILL.
https://stackoverflow.com/a/2541618/10453847
But why does the kernel still send the signal?
– Joshua
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review
– Scott
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
– dhag
15 mins ago
add a comment |
up vote
-2
down vote
up vote
-2
down vote
A program can have handlers for pretty much any signal but a KILL.
https://stackoverflow.com/a/2541618/10453847
A program can have handlers for pretty much any signal but a KILL.
https://stackoverflow.com/a/2541618/10453847
answered 3 hours ago
Don Simon
195
195
But why does the kernel still send the signal?
– Joshua
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review
– Scott
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
– dhag
15 mins ago
add a comment |
But why does the kernel still send the signal?
– Joshua
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review
– Scott
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
– dhag
15 mins ago
But why does the kernel still send the signal?
– Joshua
1 hour ago
But why does the kernel still send the signal?
– Joshua
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review
– Scott
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review
– Scott
1 hour ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
– dhag
15 mins ago
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
– dhag
15 mins ago
add a comment |
up vote
-3
down vote
Processes on exit perform several cleanup actions like freeing memory, releasing semaphores, closing files, mayhap some statistics, within their process context / environment. Although the kernel could replicate that, it's easier to tap the process on its shoulder and ask it to commit suicide.
5
I’m curious to learn how a process can do anything at all in response toSIGKILL
, unless the kernel is acting on its behalf.
– Stephen Kitt
5 hours ago
2
You are wrong. Processes do not receive a SIGKILL: unix.stackexchange.com/questions/485644/…
– What
3 hours ago
But couldn't a process be so stuck that it cannot even do these actions? Wouldn't a malicious process somehow be able to misbehave and not terminate? It would make much more sense for the kernel to just stop giving the process CPU time as indicated in the link given by @What.
– 1026501
3 hours ago
@1026501 That is exactly what happens. This response is incorrect.
– duskwuff
1 hour ago
@RudiC Wrong!!!
– Greg Schmit
1 hour ago
add a comment |
up vote
-3
down vote
Processes on exit perform several cleanup actions like freeing memory, releasing semaphores, closing files, mayhap some statistics, within their process context / environment. Although the kernel could replicate that, it's easier to tap the process on its shoulder and ask it to commit suicide.
5
I’m curious to learn how a process can do anything at all in response toSIGKILL
, unless the kernel is acting on its behalf.
– Stephen Kitt
5 hours ago
2
You are wrong. Processes do not receive a SIGKILL: unix.stackexchange.com/questions/485644/…
– What
3 hours ago
But couldn't a process be so stuck that it cannot even do these actions? Wouldn't a malicious process somehow be able to misbehave and not terminate? It would make much more sense for the kernel to just stop giving the process CPU time as indicated in the link given by @What.
– 1026501
3 hours ago
@1026501 That is exactly what happens. This response is incorrect.
– duskwuff
1 hour ago
@RudiC Wrong!!!
– Greg Schmit
1 hour ago
add a comment |
up vote
-3
down vote
up vote
-3
down vote
Processes on exit perform several cleanup actions like freeing memory, releasing semaphores, closing files, mayhap some statistics, within their process context / environment. Although the kernel could replicate that, it's easier to tap the process on its shoulder and ask it to commit suicide.
Processes on exit perform several cleanup actions like freeing memory, releasing semaphores, closing files, mayhap some statistics, within their process context / environment. Although the kernel could replicate that, it's easier to tap the process on its shoulder and ask it to commit suicide.
answered 5 hours ago
RudiC
3,8791312
3,8791312
5
I’m curious to learn how a process can do anything at all in response toSIGKILL
, unless the kernel is acting on its behalf.
– Stephen Kitt
5 hours ago
2
You are wrong. Processes do not receive a SIGKILL: unix.stackexchange.com/questions/485644/…
– What
3 hours ago
But couldn't a process be so stuck that it cannot even do these actions? Wouldn't a malicious process somehow be able to misbehave and not terminate? It would make much more sense for the kernel to just stop giving the process CPU time as indicated in the link given by @What.
– 1026501
3 hours ago
@1026501 That is exactly what happens. This response is incorrect.
– duskwuff
1 hour ago
@RudiC Wrong!!!
– Greg Schmit
1 hour ago
add a comment |
5
I’m curious to learn how a process can do anything at all in response toSIGKILL
, unless the kernel is acting on its behalf.
– Stephen Kitt
5 hours ago
2
You are wrong. Processes do not receive a SIGKILL: unix.stackexchange.com/questions/485644/…
– What
3 hours ago
But couldn't a process be so stuck that it cannot even do these actions? Wouldn't a malicious process somehow be able to misbehave and not terminate? It would make much more sense for the kernel to just stop giving the process CPU time as indicated in the link given by @What.
– 1026501
3 hours ago
@1026501 That is exactly what happens. This response is incorrect.
– duskwuff
1 hour ago
@RudiC Wrong!!!
– Greg Schmit
1 hour ago
5
5
I’m curious to learn how a process can do anything at all in response to
SIGKILL
, unless the kernel is acting on its behalf.– Stephen Kitt
5 hours ago
I’m curious to learn how a process can do anything at all in response to
SIGKILL
, unless the kernel is acting on its behalf.– Stephen Kitt
5 hours ago
2
2
You are wrong. Processes do not receive a SIGKILL: unix.stackexchange.com/questions/485644/…
– What
3 hours ago
You are wrong. Processes do not receive a SIGKILL: unix.stackexchange.com/questions/485644/…
– What
3 hours ago
But couldn't a process be so stuck that it cannot even do these actions? Wouldn't a malicious process somehow be able to misbehave and not terminate? It would make much more sense for the kernel to just stop giving the process CPU time as indicated in the link given by @What.
– 1026501
3 hours ago
But couldn't a process be so stuck that it cannot even do these actions? Wouldn't a malicious process somehow be able to misbehave and not terminate? It would make much more sense for the kernel to just stop giving the process CPU time as indicated in the link given by @What.
– 1026501
3 hours ago
@1026501 That is exactly what happens. This response is incorrect.
– duskwuff
1 hour ago
@1026501 That is exactly what happens. This response is incorrect.
– duskwuff
1 hour ago
@RudiC Wrong!!!
– Greg Schmit
1 hour ago
@RudiC Wrong!!!
– Greg Schmit
1 hour ago
add a comment |
1026501 is a new contributor. Be nice, and check out our Code of Conduct.
1026501 is a new contributor. Be nice, and check out our Code of Conduct.
1026501 is a new contributor. Be nice, and check out our Code of Conduct.
1026501 is a new contributor. Be nice, and check out our Code of Conduct.
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%2f487830%2fwhy-does-the-kernel-even-bother-to-send-sigkill%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