How does kill -QUIT process_id work?

I'm just curious. The man page for kill says that QUIT, as signal # 3, is the "main" signal. It seems that all he does for Java processes is a dump of thread information. So is QUIT wrong? Is it just that the JVM implements a single 3rd handler that flushes threads?

+5
source share
2 answers

QUIT may be wrong for Java. But with this argument, any signal name may be incorrect if the application is allowed to change the default behavior of the signal handler.

In fact, the correspondence between UNIX signal names and what they actually do has always been a bit vague and insignificant. However, developers have been dealing with this “problem” for 30 years, not being a real problem.

And yes, the Java thread stream dump behavior is implemented by the JVM. The default behavior of UNIX / LINUX is to dump the process memory, unless it is blocked by other factors.

+7
source

Yes, the JVM captures signal # 3 to clear threads. By default, for a regular unix process, it resets the kernel (i.e. takes a snapshot of the process memory and writes it to a file) and exits.

For Java, this is not very useful, so a thread dump is created instead.

+5
source

All Articles