If you have a multithreaded program (Linux 2.26 kernel), and one thread does something that causes a segfault, will the other threads still be scheduled to run? How are the other threads terminated? Can someone explain the process shutdown procedure with regard to multithreaded programs?
If you have a multithreaded program (Linux 2.26 kernel), and one thread does something
Share
When a fatal signal is delivered to a thread, either the
do_coredump()or thedo_group_exit()function is called.do_group_exit()sets the thread group exit code and then signals all the other threads in the thread group to exit withzap_other_threads(), before exiting thecurrentthread. (do_coredump()callscoredump_wait()which similarly callszap_threads()).zap_other_threads()posts aSIGKILLfor every other thread in the thread group and wakes it up withsignal_wake_up().signal_wake_up()callskick_process(), which will boot the thread into kernel mode so that it can recieve the signal, using an IPI1 if necessary (eg. if it’s executing on another CPU).1. Inter-Processor Interrupt