Hi Rajaram.... Sorry for this late reply. > <Raja> I am running the code on a single processor machine. But not a HyperThreading based processor, am I right? > <Raja> I am not sure I got your question. Yes, the parent process > (bash) should be in TASK_INTERRUPTIBLE state after we issue insmod. what I mean is, after the task (bash) is set back to TASK_INTERRUPTIBLE, is it really back to TASK_INTERRUPTIBLE? or still at TASK_UNINTERRUPTIBLE? > 2. In another console, I inserted a module to find the hung bash > process and changed its state again to TASK_INTERRUPTIBLE. > 3. Now I issued "kill -9" to kill the bash process. > 4. It worked !!! the bash process was killed . I think this was > due to that I used the correct way to change the process state i.e > set_task_state(). if that's the only thing you did, then yes....big chance set_task_state() is indeed doing the right job for you. But still, this makes me think...if you check the macro declaration, on UP, actually it does the same thing like task_struct->state=<something>. The only thing that differs is when it is used on SMP/HT.... > 1. Since the bash process received SIGKILL successfuly, it means > it has successfuly changed back from TASK_UNITERRUPTIBLE to > TASK_INTERRUPTIBLE. But after coming back to TASK_INTERRUPTIBLE > state, why did it not receive/notice the SIGCHLD signal that insmod > has already sent it long back before we inserted the second module > ...? If this had been done, it would have come to the normal bash > prompt..But this did not happen. IIRC, SIGCHLD notice the parent (bash) to do the clean up (to destroy the rest of insmod's task structure), so IMHO it actually received it and did the job. You did see the insmod process no longer exists and there is no zombie process, right? CMIIW > 2. Also I repeated all the steps again with a small change that I > tried changing the state from TASK_UNINTERRUPTIBLE to TASK_RUNNING in > the step 2 above. Now even "kill -9" did not work. IIRC, you also need to insert the task back to the runqueue... Study the activate_task() function (or maybe enqueue_task()?) > 3. A new question. Pls forget above all the things above. > I just tried current->parent->parent = current. That is I tried to > change the parent of bash to insmod ( dirty thing to do, I know :) ). > Now the whole system hung..keyboard / mouse did not respond...even I > was not able to switch off the PC by pressing the button. I had to > switch off the power supply !!. What happened in this Hehe :) You are messing up with "init" process. See, parent of insmod is bash, parent of bash is init :) So, actually you do "task_struct of init is set to task_struct of current process", got the picture now? :D regards Mulyadi -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/