Re: mixing interupts and threads.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ravi and List,

[I maybe completely wrong as this interrupt thing is quite dangerous
to talk about ;) .. apologies upfront]

On Mon, Jul 7, 2008 at 10:03 AM, ravikumar <ravikumar.vallabhu@xxxxxxxxx> wrote:
> Hello All ,
> I've a few questions.
> 1. Lets suppose i've some critical section and it is synchronized with
> locks. A thread came and  it's  execution  is in the middle of critical
> section, at this time an interrupt was occurred which  also executes
> critical section. As interrupts can't wait on any lock it will get lock and
> try to execute the critical section and above thread was not yet completed.
> So inconsistency . How this was handled in Linux.

What I understand is that If in critical section (like spin_lock)
interrupts would be disabled (at least on local CPU) and hence till
the working kernel thread releases the lock (and thus enabling
interrupts) no interrupt can break this kernel thread. In case this is
a multiprocessor system, probably the interrupts (from other CPU)
would take have to wait for the critical section lock to be released -
which I think can be a candidate for bad design (if that critical
section has any code for sleeping).

> 2.Some process is running in kernel mode, at this a kill was sent to this
> process, does this signal will delivered to the process while it is in
> kernel mode.

I don't think so - not until a proper signal handling check is there
in the kernel control path in which process is right now - which I
think would seldom be the case (may be if that is your own IOCTL
handler, for example, in which checking has been done - or may be a
kernel daemon with signal checking). But, if a signal is sent from
user-space (with appropriate credentials) it should be queued with the
process task_struct (this 'should' is my understanding).

Please feel free to point out mistakes in this answer - so that I can
correct myself as well.

>
> And also please provide some links  how threads ,signals and interrupts will
> be mixed.

I find Understanding Linux kernel book too good in this respect (but
yes, I had to read each topic many times to understand substantially).

[Also, Scott had already answered even before I could press enter -
but still I took the liberties of expressing my understanding]

--
Shreyansh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux