Introduction and application of signal correlation function

Source: Internet
Author: User

1. Signal

Execute command kill-l View list of signals

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/84/0D/wKiom1eEgz6x4ksNAACG-wv6rZI789.png-wh_500x0-wm_3 -wmp_4-s_2091179139.png "title=" capture. PNG "alt=" Wkiom1eegz6x4ksnaacg-wv6rzi789.png-wh_50 "/>

The signal is divided into two categories: common signal (1-31), real-time signal (34-64)

Note: In most cases the signal will not be executed immediately, and in most cases the signal will be terminated by default, and the signal may be executed at the appropriate time.

2, the generation of signals

generated by: keys, exceptions (memory out of bounds, except 0), instructions, calling system functions

1) Key:

When a user presses certain keys at the terminal, the terminal driver sends a signal to the foreground process, for example CTRL-C generates SIGINT

Ctrl-\ generates a sigquit signal, CTRL-Z produces a SIGTSTP signal.

What is core dumped?

When a process terminates abnormally, it is possible to save all the user space memory data of the process to disk, usually the core, which is called core Dump. Process abort is usually due to a bug, such as illegal memory access resulting in a segment error, after which you can check the core file with the debugger to identify the cause of the error, this is called Post-mortem debug (post-mortem). How much core files a process allows to produce depends on the resource Limit of the process (this information is stored in the PCB). The default is not to allow core files to be generated because the core file

may contain sensitive information such as user passwords, not secure.

Restrictions can be modified by command:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/84/0E/wKiom1eEiCWRw3nuAAAS3rsiP8c148.png "title=" capture. PNG "alt=" Wkiom1eeicwrw3nuaaas3rsip8c148.png "/>

First write a dead loop program, use Ctrl-\ to terminate the program, to see the size of the core file

The program is:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/84/0D/wKioL1eEi0-y1ZhdAAAhZUOv91U472.png-wh_500x0-wm_3 -wmp_4-s_1584908838.png "title=" capture. PNG "alt=" Wkiol1eei0-y1zhdaaahzuov91u472.png-wh_50 "/>

The result is:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/84/0E/wKiom1eEivHyUOriAABG0HRoe7Y398.png "title=" capture. PNG "alt=" Wkiom1eeivhyuoriaabg0hroe7y398.png "/>

2) Exception:

Hardware anomalies generate signals that the hardware detects and notifies the kernel, and the kernel sends the appropriate signal to the current process. For example, the current process executes the instruction divided by 0, and the CPU's unit of operation generates an exception, which the kernel interprets as a SIGFPE signal sent to the process. If the current process accesses an illegal memory address, the MMU will produce an exception, and the kernel interprets the exception as a SIGSEGV signal sent to the process.

3) Call system functions:

The dead Loop program is executed in the background first, and then the KILL command is used to send the SIGSEGV signal to it. (The command is appended with & the foreground process transitions to the background process)

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/84/0E/wKiom1eEjiewpQuKAAAz_iyiYjI777.png-wh_500x0-wm_3 -wmp_4-s_3233459087.png "title=" capture. PNG "alt=" Wkiom1eejiewpqukaaaz_iyiyji777.png-wh_50 "/>


3, the Signal processing

The processing method consists of three kinds, namely:

1) Ignore this signal

2) perform the default action

3) Perform a custom function


4. Blocking signal

The processing action of the signal is called the signal recursion (Delivery), the signal from the generation to the state between the recursion, called signal pending (Pending). A process can choose to block (block) a signal. When the blocked signal is generated, it remains in the pending state until the process has unblocked the signal and executes the recursive action. Note that blocking and ignoring are different , as long as the signal is blocked will not be recursive, and ignore is a recursive after the optional processing action.

The signal is in the kernel:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/84/0F/wKiom1eEj67xFrpBAAGagzhqPNY990.png-wh_500x0-wm_3 -wmp_4-s_2923487456.png "title=" ac60b554bed474a46564629c6ab2cfd4_ see king. png "alt=" Wkiom1eej67xfrpbaagagzhqpny990.png-wh_50 "/>

5. Signal set operation function:

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/84/0F/wKiom1eEkL6whuAhAABtNT7w9kc882.png-wh_500x0-wm_3 -wmp_4-s_1551578766.png "title=" Qq20160712143948.png "alt=" Wkiom1eekl6whuahaabtnt7w9kc882.png-wh_50 "/>

The function Sigemptyset initializes the set of signals that the set points to, so that the corresponding bit of all the signals is zeroed, indicating that the signal set does not contain any valid signals. The function Sigfillset initializes the set of signals that the set points to, so that the corresponding bit of all the signals is placed, indicating that the valid signal of the signal set includes all signals supported by the system. Note that before using a variable of type sigset_t, be sure to call Sigemptyset or Sigfillset to initialize it so that the signal set is in a determined state. After initializing the sigset_t variable, you can add or remove a valid signal from the signal set by calling Sigaddset and Sigdelset. All four functions return 0 successfully, and an error returns-1. Sigismember is a Boolean function that is used to determine whether a signal set in the valid signal contains a certain signal, if included is returned 1, does not contain the return 0, an error returns-1.

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/84/0F/wKiom1eEkXaQp5AqAACkZV6CG60859.png-wh_500x0-wm_3 -wmp_4-s_3915992189.png "title=" Qq20160712144254.png "alt=" Wkiom1eekxaqp5aqaackzv6cg60859.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/84/0E/wKioL1eEkbPQlPYLAABorX3AXLI897.png-wh_500x0-wm_3 -wmp_4-s_1917596736.png "title=" Qq20160712144357.png "alt=" Wkiol1eekbpqlpylaaborx3axli897.png-wh_50 "/>

The following procedure is an example of the use of functions:

Program:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/84/0F/wKioL1eEmjOS-hoNAAG6Y4KQ2M0908.png-wh_500x0-wm_3 -wmp_4-s_1747257418.png "title=" Image.png "alt=" Wkiol1eemjos-honaag6y4kq2m0908.png-wh_50 "/>

Results Analysis:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/84/10/wKiom1eEmy6hC8r1AACOjm1Q9mE936.png-wh_500x0-wm_3 -wmp_4-s_2939244057.png "title=" Image.png "alt=" Wkiom1eemy6hc8r1aacojm1q9me936.png-wh_50 "/>




This article is from the "lovemeright" blog, make sure to keep this source http://lovemeright.blog.51cto.com/10808587/1825740

Introduction and application of signal correlation function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.