Signalling suspended process through CTRL-Z
Each process has always one of the five states TASK_RUNNING, TASK_INTERRUPTIBLE, TASK_UNINTERRUPTIBLE, TASK_STOPPED, TASK_ZOMBIE.
If the running process(TASK_RUNNING) is suspended using Ctrl-Z,
a) which state does it go to - TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE?
b) User can re-run(TASK_RUNNING) this suspended process by bg(background), fg(foreground) or explcitly sending CONT signal. Are these only available means to wake the suspended process? OR kernel can wake these process in other events also? (May be suspended process has registered timer handler and timer pops after the process has been suspended by CTRL-Z, resulting in waking up the process and running the timer handler and stay in TASK_RUNNING state or go back to SLEEP(TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE) state.
While studying signal further, I noticed in one instance where I sent a process SIGCONT signal using kill - kill(process_id, SIGCONT) and process entered in STOPPED state and kill system call did not return.
The program I was trying is to let the process run when it receives the SIGTSTP. So I registered the handler for the SIGTSTP signal and in this handler, the process sent SIGCONT signal using kill() system call. Instead of continuing, the process entered the STOPPED state. I took core dump of STOPPED process and I saw the kill() system call never returned.
What could be the reason for this behaviour by process?
The process was running when SIGSTP signal received and the signal handler ensured that It does not go into STOPPED state and yet process entered in the STOPPED state,
greenday, please be aware that some signals cannot be blocked. Sometimes the signal man page in manual section 7 can be very helpful, as can be displayed by executing the command:
|All times are GMT -5. The time now is 05:23 PM.|