LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 09-05-2012, 01:56 PM   #1
greenday
LQ Newbie
 
Registered: Sep 2012
Posts: 8

Rep: Reputation: Disabled
Lightbulb Signalling suspended process through CTRL-Z


Hello,


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.


Thanks :-\
 
Old 09-06-2012, 11:40 PM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
1. Task_stopped
 
Old 09-18-2012, 10:21 AM   #3
greenday
LQ Newbie
 
Registered: Sep 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks Ygrex.

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,


Santosh.
 
Old 09-21-2012, 10:25 PM   #4
kakaka
Member
 
Registered: Sep 2003
Posts: 382

Rep: Reputation: 86
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:

Code:
man -S 7 signal
If you are having some specific issue, perhaps for the sake of clarity, you could post some simple source code which illustrates the problem, and ask a very specific question about the code.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ctrl-C kills background process also Niraj Kulkarni Linux - Newbie 3 12-15-2008 06:11 AM
how ctrl+c works to terminate a process rithik_ghoshal Linux - General 2 11-02-2008 08:01 AM
ctrl-c to terminate a process does not work geek1234 Linux - Newbie 1 12-26-2007 02:34 PM
difference between Channel Associated Signalling and Common Channel Signalling sailu_mvn Linux - Software 3 03-31-2006 06:25 AM
How to send CTRL-D to child process via a pipe? neo_in_matrix Programming 10 09-15-2005 07:09 PM


All times are GMT -5. The time now is 04:49 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration