c - What happens when a program receives SIGTSTP signal -


i wrote program in c , need handle ctrl + z , corresponding signals sigtstp , sigcont.

what happens variables , process after signal received?
after signal handled through signal handler signal(sigcont, &sig_handler);, happens process?

there (at least) 3 possible situations:

  • the process running in userspace:

    in case, process preempted (a similar way when timeslice ran out when multitasking) , not considered rescheduling until resumed.

  • the process waiting in syscall:

    usually syscall interrupted , process not considered scheduling until resumed. when resumed, syscalls return -eintr , have restarted. syscalls restarted automatically.

  • the process disk-waiting (state d), e.g. waiting buffer/page-in:

    the signal set pending, not delivered until operation finished. after that, same 1 of situations above.

usually quite transparent process itself.

this same default action of sigtstp , sigstop (the latter cannot caught or ignored, however).


Comments