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