Multi-Threading and signaling

Source: Internet
Author: User
Tags session id

1. Each thread has its own signal screen word

2. Each thread shares a signal processing function for the same signal.

3. After the main thread is set Pthread_sigmask, the sub-thread will copy a set of signal screen words.

Then we'll look at the comparison between the thread and the process.

The child process inherits the properties of the parent process:

Child threads inherit the properties of the main thread:

actual user ID, actual group ID, valid user ID, valid group ID,

process group ID;

session ID;

control terminal;

set User ID flag and set group ID flag;

signal shielding and arrangement;

environment;

storage map;

Resource limit;

All the information in the process is shared for all threads of the process,

the processing of the signal is shared by all threads in the process (note: If the default processing of the signal is to terminate the process then the process will be killed by passing the signal to a thread as well) ;

 

Differences between parent and child processes:

Sub-line thread:

The return value of the fork (=0 subprocess);

The process ID is different;

Two processes have a different parent process ID;

The Tms_utime,tms_stime,tms_cutime and tms_ustime of the child process are set to 0;

File locks that do not inherit the parent process settings;

The unhandled alarm of the child process is cleared;

The unhandled signal set of the child process is set to the empty sets;

Thread ID;

A set of register values;

Stack

scheduling priorities and policies;

signal shielding word;

errno variable;

Thread-private data;

Multi-Threading and signaling

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.