<br><br><div class="gmail_quote">On Thu, Jan 19, 2012 at 10:54 PM, Dave Hylands <span dir="ltr"><<a href="mailto:dhylands@gmail.com">dhylands@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<div class="im">On Thu, Jan 19, 2012 at 7:26 AM, Mulyadi Santosa<br>
<<a href="mailto:mulyadi.santosa@gmail.com">mulyadi.santosa@gmail.com</a>> wrote:<br>
> Hi again :)<br>
><br>
> On Thu, Jan 19, 2012 at 16:03, Darshan Ghumare<br>
> <<a href="mailto:darshan.ghumare@gmail.com">darshan.ghumare@gmail.com</a>> wrote:<br>
>> What if, there is one process which is in middle of a syscall which has<br>
>> infinite loop in it received SIGKILL & there are no other processes in the<br>
>> system?<br>
><br>
> infinite loop such as "for(;;)" ? well as long as it doesn't disable<br>
> or masked out the timer interrupt, sooner or later timer interrupt<br>
> will kick in. It then followed by the usual tick handler. Inside it,<br>
> IIRC, will provoke the current running process to check queued signal<br>
> and handle it.<br>
<br>
</div>If the process was in an infinite loop in user space, what Mulyadi<br>
says is true. If it were a real-time process in an infinite loop then<br>
it might very well be unkillable (unless there is a higher priority<br>
thread which can do the killing).<br>
<br>
My understanding is that in kernel space signals only get handled when<br>
you run into code which specifically deals with signals. All of the<br>
syscalls are wrapped with such code. So, if you're in an infinite loop<br>
in kernel space, then you're in essentially the same situation as<br>
doing a non-interruptible down which never completes.<br>
<br>
If the kernel were to kill the process just because a preemption<br>
occurred (while in kernel space) then you would very often be killing<br>
processes which are currently holding a semaphore or something and<br>
leaving the kernel in a potentially unstable state.<br>
<br>
There is always at least one runnable thread, called the idle thread.<br>
There is an idle thread for each CPU.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div>What if,</div><div>spin_lock_irqsave(&lock, flags);</div><div>for ( ; ; )</div><div>{</div><div> ;</div><div>}</div><div>spin_lock_irqrestore(&lock, flags);</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
--<br>
Dave Hylands<br>
Shuswap, BC, Canada<br>
<a href="http://www.davehylands.com" target="_blank">http://www.davehylands.com</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>DarshanŽ<br>