Linux internal context variables: what happens when a process exits before a timer interrupt?

How does the context switch in the linux kernel when the process exits before the timer is interrupted?

I know that if the process is started and the timer is interrupted, the function scheduleis called automatically, if the flag is set, the schedule function then selects the next process to start. Basically, in this case, the schedule function works in the context of the current process, but what happens when the process exits even before the timer is interrupted? which calls the function schedulein this case? And in what context does it work?

+4
source share
1 answer

, - , schedule . , , , , - . - , - , "" , ..

- , do_exit () . do_exit schedule , schedule . , do_exit schedule, BUG(); .

, do_exit exit_notify, SIGCHLD / wait. , , schedule .

do_exit , , , .. task_struct , - wait, , ​​, ; .

_exit, sys_exit_group do_group_exit do_exit. (, SIGSEGV), . , (, x86 do_trap) force_sig_info send_signal complete_signal, , . , , , get_signal, do_group_exit, do_exit. (, kill 12345 ) sys_kill kill_something_info, group_send_sig_info, do_send_sig_info send_signal, , . complete_signal , , " ", .

, Linux, . Unix , , Linux do_exit schedule, , _exit, , .

+4

Source: https://habr.com/ru/post/1655649/


All Articles