Linux Programming---process programming

Source: Internet
Author: User

Process communication (IPC)---signal processing

Signal: Through the command kill–l view---signal can be generated by the hardware, can also be generated by software

The function of the software to generate the signal:

Kill function, raise function, alarm function, Setitimer function

1:kill function

Function: The system initiates a signal to the process; it's the first case.

Parameters: PID process number; SIG Signal

2:raise function

Function: signal to this process

Parameter: SIG Signal

3:alarm function

function: Send SIGALRM signal to this process after a certain time---the default action is to end the process

Parameters: Seconds set the time in units of seconds

Signal Operation function:

Sigemptyset function, Sigfillset function, Sigaddset function, Sigdelset function, Sigismember function, sigprocmask function, sigaction function

Pause function, sigsuspend function, sigsetjmp function, siglongjmp function

1:sigemptyset function

Function: Initialize signal collection, set to NULL

Parameters: Set Signal set

2:sigfillset function

Function: Initialize the signal set, block all the signals, that is, the signal is set to 1;

Parameters: Set Signal set

3:sigaddset function

Function: Add signal to signal set

Parameters: Set signal set; Signo as signal;

4:sigdelset function

Function: Delete the signal in the signal set;

Parameters: Set signal set, Signo signal;

5:sigismember function

Function: Determine if the signal is in it

Parameters: Set signal set, Signo signal

6:sigprocmask function

Function: Do some operation on the signal set

Parameters: How to identify how to operate:

Set signal set; Oset the set of signals that hold the current signal blocking

7:sigaction function

Function: Transfer to a custom function to handle the message

Parameters: Signo signal (except sigkill,sigstop signal), ACT structure is how to deal with this signal, oact is the information that processing the signal before

Structural body: sigaction

The point is the first one: the function that points to the signal processing. with one parameter Signo; 2nd, the 5 parameter is the same as the first parameter, the 41st is 0, and the third is the set that sets the blocking signal.

8:pause function, Sigsuspend function

Process suspend function

9:sigsetjmp function, siglongjmp function

Jump Function---goto similarity

Process communication (IPC)---pipelines

Pipeline: Communication process Communication, use of documents;

Parameter Fildes has 2 file identification number, the first is to represent the read end, the second represents the write end---Common file 2 file identification number

REDIRECT Operation

Redirect the new file to the old file identification number to achieve the redirect effect.

Process communication (IPC)---Message Queuing

Linux Programming---process programming

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.