Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ Linux signal and orphans, and zombie process     - Fedora 19/20 and Debian Jessie / Sid users to install FFmpeg 2.3.2 (Linux)

- Ubuntu study notes and related problem solving (Linux)

- Qt signals and slots mechanism (Programming)

- Linux platform Oracle MySQL connection (Database)

- About AWR More Description (Database)

- Mounting Windows shared directory system under the Linux (Linux)

- Linux systems for entry-learning - Install Go language in Linux (Linux)

- How to install the latest version of the Eclipse in Ubuntu 14.04 (Linux)

- XtraBackup achieve non-stop use of master-slave synchronization service (Database)

- Linux itself disguised illusion strengthen security (Linux)

- CentOS 7.0 Enable iptables firewall (Linux)

- CentOS 7.0 Experience with previous versions (Linux)

- Installation of Python2.7.10 under CentOS 6.4 (Linux)

- CentOS7 install and configure Nagios (Server)

- Java filter (Programming)

- Installation under Linux Mint system guidelines for Gtk (Linux)

- How to identify memory leaks in Java (Programming)

- Linux shell in back quotes (`) Application (Linux)

- CentOS6.x and Windows XP and Windows Server 2003 Open IPv6 related matters (Linux)

- Configuring Allatori code confusion when developing general Java applications in NetBeans (Programming)

 
         
  Linux signal and orphans, and zombie process
     
  Add Date : 2018-11-21      
         
         
         
  Reliable and unreliable signal signal
Unreliable signal :( inherited from unix to) do not support queuing may be lost, such as repeatedly sending the same signal, the process received only once. An unreliable signal signal SIGRTMIN before.
Reliable signal :( newly added) support queue, will not be lost, how many times sending will receive many times. It is a reliable signal SIGRTMIN to SIGRTMAX between.

View a list of signals
$ Kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM
16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP
21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ
26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR
31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN + 1 36) SIGRTMIN + 2 37) SIGRTMIN + 3
38) SIGRTMIN + 4 39) SIGRTMIN + 5 40) SIGRTMIN + 6 41) SIGRTMIN + 7 42) SIGRTMIN + 8
43) SIGRTMIN + 9 44) SIGRTMIN + 10 45) SIGRTMIN + 11 46) SIGRTMIN + 12 47) SIGRTMIN + 13
48) SIGRTMIN + 14 49) SIGRTMIN + 15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7
58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2
63) SIGRTMAX-1 64) SIGRTMAX

Use kill to send signals to processes
kill -signum pid

Designation signal processing function
#include
typedef void (* sighandler_t) (int);
sighandler_t signal (int signum, sighandler_t handler);

struct sigaction {
void (* sa_handler) (int);
void (* sa_sigaction) (int, siginfo_t *, void *);
sigset_t sa_mask;
int sa_flags;
void (* sa_restorer) (void);
};
int sigaction (int signum, const struct sigaction * act, struct sigaction * oldact);

1) SIGHUP
The signal at the user terminal is connected to the end of the issue (normal or abnormal), usually at the end of the process control terminal, inform each job within the same session, when they are no longer associated with the control terminal.

When you log Linux, the system will assign the user to log on a terminal (Session). In this terminal, all programs run, and the foreground process group of a background process group includes, generally belong to this Session. When users log on exit Linux, the foreground process group and have the background to the process output terminal will receive a SIGHUP signal. The default action of this signal is to terminate the process, so have the background and the foreground process group of the process output terminal is terminated. But it can capture the signal, such as wget capture SIGHUP signal, and ignore it, so even out of the Linux login, wget can continue to download.

In addition, the terminal from the daemon relations, this signal is used to tell it to reread the configuration file.

2) SIGINT
Program termination (interrupt) signal is issued in a user typing INTR character (usually Ctrl-C), the notification for the foreground process group to terminate the process.

3) SIGQUIT
And SIGINT similar, but the QUIT character (usually Ctrl- /) to control the process in due receipt will generate core files SIGQUIT exit, in this sense is similar to a program error signal.

4) SIGILL
Has performed an illegal instruction an executable file itself is usually because an error occurs, or trying to perform a data segment. This signal is also possible to generate a stack overflow.

5) SIGTRAP
Generated by the trap instruction breakpoint instruction or other use by the debugger.

6) SIGABRT
Function calls abort signal generated.

7) SIGBUS
Illegal address, including memory address alignment (alignment) error. Such as access to a long integer words, but the address is not a multiple of 4. It differs SIGSEGV is that the latter is due to the unauthorized access to the memory address of a legitimate trigger (such as access is not his own memory space or read-only memory).

8) SIGFPE
Issued fatal arithmetic error occurs not only includes floating-point error, further comprising an overflow and divide by zero, etc. All other arithmetic errors.

9) SIGKILL
For an immediate end to run the program. This signal can not be blocked, treatment and neglect. If an administrator can not find a process to terminate, you can try to send this signal.

10) SIGUSR1
Leaving users

11) SIGSEGV
Attempts to access its own memory not allocated to, or attempt to not have write access to the memory address to write data.

12) SIGUSR2
Leaving users

13) SIGPIPE
Pipeline rupture. This signal is typically generated in the inter-process communication, such as using two processes FIFO (pipe) communications, did not open or read the pipeline terminates unexpectedly go out into the pipe write, write process will receive a SIGPIPE signal. Further two processes Socket Communications, the writing process writing Socket when the reading process has been terminated.

14) SIGALRM
Clock timing signal, calculating the actual time or clock time. Alarm function using the signal.

15) SIGTERM
End of program (terminate) signal, and SIGKILL except that the signal can be blocked and processed. Often used to ask an application to exit gracefully, shell command to kill the signal generated by default. If the process is not terminated, we will try SIGKILL.

17) SIGCHLD
At the end of the child process, the parent process will receive the signal.

If the parent does not handle this signal, there is no wait (wait) child, although the child process to terminate, but also holds entries in the kernel process table, then the child process is called a zombie process. In this case we should avoid (the parent process or ignore SIGCHILD signal or capturing it, or wait it derives the child, or parent process to terminate, then the child process to terminate automatically be taken over by the init process).

18) SIGCONT
Make a stop (stopped) process continues. This signal can not be blocked. You can use a handler to let the program accomplish a specific task in the stopped state to the continued execution, for example, displays a prompt again

19) SIGSTOP
Stop (stopped) process execution and note the difference between it and terminate interrupt: This process is not over, just suspend the implementation of this signal can not be blocked, handled or ignored.

20) SIGTSTP
Stop the process of running, but the signal can be processed and ignored. When the user types the SUSP character (usually Ctrl-Z) asserts this signal

21) SIGTTIN
When a background job from the user terminal to read data, the job of all the process will receive SIGTTIN signal. By default these processes will stop execution.

22) SIGTTOU
Similar SIGTTIN, but received write terminal (or modify terminal mode).

23) SIGURG
There is generated when the data or out-of-band data arrives socket "emergency."

24) SIGXCPU
CPU time limit exceeded. This limit may be made getrlimit / setrlimit to read / change.

25) SIGXFSZ
When a process attempts to expand the file so that the file size exceeds the resource limit.

26) SIGVTALRM
Virtual clock signal similar SIGALRM, but the calculation is that the process of CPU time.

27) SIGPROF
Like SIGALRM / SIGVTALRM, but includes time with the process of CPU time, and system calls.

28) SIGWINCH
Issued when the window size changes.

29) SIGIO
File descriptor is ready, you can begin input / output operations.

30) SIGPWR
Power failure

31) SIGSYS
Illegal system call.

Signal listed above, the program can not capture, block or ignore signals have: SIGKILL, SIGSTOP
Not return to the default action of the signal has: SIGILL, SIGTRAP
The default will lead the process of abortion signal has: SIGABRT, SIGBUS, SIGFPE, SIGILL, SIGIOT, SIGQUIT, SIGSEGV, SIGTRAP, SIGXCPU, SIGXFSZ
The default will cause a process to exit signal has: SIGALRM, SIGHUP, SIGINT, SIGKILL, SIGPIPE, SIGPOLL, SIGPROF, SIGSYS, SIGTERM, SIGUSR1, SIGUSR2, SIGVTALRM
The default would cause the process to stop the signal has: SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU
The default process ignores the signal has: SIGCHLD, SIGPWR, SIGURG, SIGWINCH

Orphan processes: parent process completed or terminated, the process is still running. Such process will be adopted init process, init process to complete their collection.

Zombie process: After the child process, the parent process does not wait for it (the child process calls wait waitpid obtain state information), the sub-process descriptor of the process is still being kept in the system, this process is called a zombie process.

To sum up the difference between the two: in fact, the parent and child who should die issues.

Parent die first, the child did not father and mother, orphaned; (init after being adopted, it is not an orphan)

Child die first, the parent process does not remove it (wait), the child process becomes a zombie.
     
         
         
         
  More:      
 
- SSH automatic disconnection problem solving (Linux)
- Linux 64-bit porting (Programming)
- Install apr support for Tomcat on Linux (Server)
- Linux shell script under the use of randomly generated passwords (Programming)
- Diagnose and resolve the SSH connection slow (Linux)
- Try debugfs restore the deleted files ext3 file system (Linux)
- How to adjust the system time CentOS (Linux)
- redis main building and disaster recovery from a cluster deployment (Database)
- C ++ 11 feature: auto keyword (Programming)
- Oracle GoldenGate Installation and Configuration Tutorial Introduction (Database)
- How to choose the first programming language based on the life you want (Programming)
- Expert advice: Do not use the computer security IE browser (Linux)
- Python data types summary (Programming)
- MySQL & NoSQL - Memcached widget (Database)
- IntelliJ IDEA common list of shortcuts (Linux)
- Linux support exFAT and NTFS (Linux)
- Linux System Tutorial: Ubuntu on the desktop is disabled by default keyring to unlock tips (Linux)
- Docker + OpenvSwitch build experimental environment VxLAN (Server)
- Linux awk text analysis tool (Linux)
- How to determine whether the Linux server was hacked (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.