Meaning and typical use of -3 signal in kill


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Meaning and typical use of -3 signal in kill
# 1  
Old 08-19-2010
Meaning and typical use of -3 signal in kill

Hi,

What is the use of the signal -3 in kill command in unix?

I read the meaning and typical use of this signal in one of the Oreilly books as below.

Code:
Quit -- stop running (and dump core). Sent when you type CTRL-\.

what does the CTRL-\ command do? Is it the combination of CTRL and hyphen and backslash?

Thanks in advance.
# 2  
Old 08-19-2010
as it says - kills the process and dumps the core:

e.g:

Code:
% sleep 1000
^\Quit (core dumped)
% file core
core:           ELF 32-bit MSB core file SPARC Version 1, from 'sleep'

( and it's it's just hold ctrl and hit \ )

HTH
# 3  
Old 08-19-2010
Thanks Tytalus!!!

Should we press ctrl and \ along with the command " kill -3 <<PID>>"
# 4  
Old 08-19-2010
ctrl \ if process is in foreground

kill -3 <pid> if you are referencing a process that is not under immediate control...
# 5  
Old 08-19-2010
The SIGQUIT (signal number 3) is triggered when you either issue "kill -3" or press the keystroke matching "quit".

To see the key mappings for your terminal use stty.

Code:
stty -a

On many systems the default mapping for "quit" is "ctrl backslash". This is one keystroke using the ctrl key like a shift key.

The place to find the full list of signals varies according to the Operating System. The "stty -a" enquiry is pretty universal.
# 6  
Old 08-19-2010
Can you elaborate more on this Tytalus? I have just executed the kill command and checked the below command to see the process

Code:
ps -ef | grep java

i did not see the same process id again. Hence i pressed ctrl and \ , but no go. However the process id appeared after some time. Am i in the right path?
# 7  
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

7. 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

8. 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

9. 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
Login or Register to Ask a Question