In that year, I learned Linux C-Signal Processing Methods step by step & Practical Application ~

Source: Internet
Author: User



This seriesArticlePrepared by muge0913, reprinted please indicate the source Thank you: http://blog.csdn.net/muge0913/article/details/7322844


Signals are used for one-step events. When a signal occurs,ProgramThe operation will be performed according to the configured program.

 

Processes generally process signals in two ways:

1,Capture Signal: When a signal sends a process, the process calls the signal processing function registered for this signal to complete the corresponding operations. Corresponding to each signal system, a corresponding default processing function is generally used to terminate a process ). Therefore, you can set the signal as the default processing function.

2,Ignore Signal. When the signal is sent, the process ignores the signal.

Note: There are two signals: sigkill and sigstop, which cannot be captured or ignored. They are provided to administrators and can be set to terminate a process at any time..

 

 

Requirement on Signal Processing: Sometimes the process needs to respond immediately to a signal During User Programming. For some real-time processes, they are unwilling to be interrupted during execution. This means they need to suspend the received signal.

 

Signal usage:

One of the most common applications of signals is to notify the process to end when an error occurs. For many errors, such as bus errors, floating point errors, and calling memory errors, the process is notified accordingly.

 

In addition, the signal has other functions. For example, running a large scientific computing program, if printf is used in an infinite loop to display the running status, it will inevitably lead to a decrease in the running efficiency. Therefore, by sending messages manually to processes to view the running status, the running efficiency is greatly improved.


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.