Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Meaning and typical use of -3 signal in kill Post 302446802 by methyl on Thursday 19th of August 2010 07:02:13 PM
Old 08-19-2010
Okay here we go. The long explanation. Other correspondants may wish to add more.

When you issue "kill -n" the value of "n" is a numeric representation of the "signal". The list of signal numbers and their meaning for your Operating System is always available ... but we don't know which O/S you have.


The "quit" control code (in you case ctrl \) can be typed at a keyboard to deliberately crash a foreground process which is running on your terminal at that time and then produce a core dump. This is why many administrators disable this control code in user sessions. Unless you are in a development environment the core dump is of no value.
When typed at a keyboard the "quit" control code has no effect whatsoever on background processes.

The "kill -3 <pid>" unix command sends the signal to the background process with Process Identity <pid> (or for that matter to a process running in foreground on a terminal other than your own) asking that process to stop immediately and dump core. Unless you are in a development environment the core dump has no value.
Be aware that a process can be written to ignore any signal (except signal 9).

Though stating the obvious you cannot issue a "kill" command on your own terminal to your own foreground process because you do not have a command prompt at the time.

Most administrators would actually issue "kill -15" (hangup) to a broken background process unless of course the process is a database application which requires a specific different signal. The hangup signal simulates pulling out the cable on a serial terminal and most well-written applications will close tidily.

Most administrators (and users) would issue ctrl/C (interrupt) to a foreground process to ask it to stop. Administrators often disable this key at unix level where it needed by the application or when they don't want users crashing applications and being presented with a unix command prompt.
The ctrl/C keystroke has a similar function in Microsoft MSDOS and just happened to like unix and CP/M when MSDOS first came out.

The unix shell "trap" command can be used to intercept signals (excluding signal 9) and this can be useful for invoking a cleanup procedure.


Beware: There is rarely ever a reason to issue "kill -9" to a process and it should never ever be issued to a database server or client unless perhaps you are already in dire straits and cannot shut a server down just prior to restoring your backup.
You will find in you research that some critical unix processes (like "inetd") respond to specific signals and restart themselves cleanly after re-reading parameter files. This convenience is rarely found in commercial applications.


Footnote: Some unix kernels have a very limited default maximum process number and can recycle Process IDs rather too quickly. It may be that this is what is happening to you? A commercial unix will need a kernel build to match the expected load and this will usually cause a substantial increase in the maximum value of a Process ID and therefore less frequent recycling of Process IDs.

Last edited by methyl; 08-19-2010 at 08:13 PM.. Reason: typos,spellin
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

kill signal

Hello e'bdy, We have WebSphere MQ running on AIX 5.1 Every weekend MQ receives a kill -30 signal from some process or user and offloads a big error file. There is no way in MQ through which that process can be tracked. Is there something which i can do on UNIX level to trap the process? Best... (3 Replies)
Discussion started by: jhaavinash
3 Replies

2. UNIX for Advanced & Expert Users

Kill Signal

Hello, I'm doing a project of OS simulation (Process Scheduling, to be very specific). Can anyone, please, explain what exactly happens in the background when we see "Sending all processes the KILL signal...........". How is it sent to each process? Is it that something like a boolean is stored... (3 Replies)
Discussion started by: ameya
3 Replies

3. Solaris

Typical way to disable a dameon

I want to disable some services starting automatically while system booting, for instance if i want to disable vold what i have to do ? i think some services related to a script init level shell directory,and i think as well that since solaris 10 they added a command to enable and disable services... (2 Replies)
Discussion started by: XP_2600
2 Replies

4. Shell Programming and Scripting

typical mail script

hi i have a requirement to write a mail script which needs to be automated.There are 7 CSV files generated for 7 clients in a single day.Each file will contain one header and the name of the file follows a nomenclature like ABC_20080402_ClientID.csv.ClientID is lets say... (3 Replies)
Discussion started by: dr46014
3 Replies

5. Shell Programming and Scripting

How to Trap kill -9 signal

I just want to trap kill -9 signal issued by any of user from any terminal and just capture that user terminal who had raised this kill -9 command (1 Reply)
Discussion started by: puneet.goel
1 Replies

6. Shell Programming and Scripting

A typical array script

Hi All, I need to store the output of "find ." to an array one by one. Output of find . in my case will look like :- . ./one ./one/a ./one/b ./one/c ./two So my first array element should be "/one" and second one "/one/a" (need to remove "." from the output as well). Then I need to... (11 Replies)
Discussion started by: Renjesh
11 Replies

7. Emergency UNIX and Linux Support

Calculating total space in GB for all files with typical pattern

Hi Experts, In a particular dir, I have many files *AJAY*. How can I get total size of all such files. I tried du -hs *AJAY* but it gave me individual size of all files. All I require is summation of all. Thanks, Ajay (4 Replies)
Discussion started by: ajaypatil_am
4 Replies

8. Shell Programming and Scripting

Typical problem in UNIX

Input file I have a file with four fields. f1,f2,f3,f4 A,1,10,00,S B,2,20,00,00,D C,3,100,00,00,G I want Output like f1|f2|f3|f4 A|1|10,00|S B|2|20,00,00|D C|3|100,00,00|G please help on this (4 Replies)
Discussion started by: bharat1211
4 Replies

9. UNIX for Dummies Questions & Answers

How to compile a software for a non-typical platform?

I am quite new to compiling source codes in linux and have been running into a lot of problems in trying to do so since the platform configuration is different from most. For starters, I know that you need to enter the following commands in order to install any software manually in linux:... (2 Replies)
Discussion started by: Ice_Drake1
2 Replies
KILL(1) 							   User Commands							   KILL(1)

NAME
kill - terminate a process SYNOPSIS
kill [-s signal|-p] [-q sigval] [-a] [--] pid... kill -l [signal] DESCRIPTION
The command kill sends the specified signal to the specified process or process group. If no signal is specified, the TERM signal is sent. The TERM signal will kill processes which do not catch this signal. For other processes, it may be necessary to use the KILL (9) signal, since this signal cannot be caught. Most modern shells have a builtin kill function, with a usage rather similar to that of the command described here. The '-a' and '-p' options, and the possibility to specify processes by command name are a local extension. If sig is 0, then no signal is sent, but error checking is still performed. OPTIONS
pid... Specify the list of processes that kill should signal. Each pid can be one of five things: n where n is larger than 0. The process with pid n will be signaled. 0 All processes in the current process group are signaled. -1 All processes with pid larger than 1 will be signaled. -n where n is larger than 1. All processes in process group n are signaled. When an argument of the form '-n' is given, and it is meant to denote a process group, either the signal must be specified first, or the argument must be preceded by a '--' option, otherwise it will be taken as the signal to send. commandname All processes invoked using that name will be signaled. -s, --signal signal Specify the signal to send. The signal may be given as a signal name or number. -l, --list [signal] Print a list of signal names, or convert signal given as argument to a name. The signals are found in /usr/include/linux/signal.h -L, --table Similar to -l, but will print signal names and their corresponding numbers. -a, --all Do not restrict the commandname-to-pid conversion to processes with the same uid as the present process. -p, --pid Specify that kill should only print the process id (pid) of the named processes, and not send any signals. -q, --queue sigval Use sigqueue(2) rather than kill(2) and the sigval argument is used to specify an integer to be sent with the signal. If the receiving process has installed a handler for this signal using the SA_SIGINFO flag to sigaction(2), then it can obtain this data via the si_value field of the siginfo_t structure. NOTES
It is not possible to send a signal to explicitly selected thread in a multithreaded process by kill(2) syscall. If kill(2) is used to send a signal to a thread group, then kernel selects arbitrary member of the thread group that has not blocked the signal. For more details see clone(2) CLONE_THREAD description. The command kill(1) as well as syscall kill(2) accepts TID (thread ID, see gettid(2)) as argument. In this case the kill behavior is not changed and the signal is also delivered to the thread group rather than to the specified thread. SEE ALSO
bash(1), tcsh(1), kill(2), sigvec(2), signal(7) AUTHOR
Taken from BSD 4.4. The ability to translate process names to process ids was added by Salvatore Valente <svalente@mit.edu>. AVAILABILITY
The kill command is part of the util-linux package and is available from Linux Kernel Archive <ftp://ftp.kernel.org/pub/linux/utils/util- linux/>. util-linux March 2013 KILL(1)
All times are GMT -4. The time now is 07:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy