Re: How Does Interrupt Handler works in this case?

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

 



On 4/11/06, Manjunath Naik <peter.desouzain@xxxxxxxxx> wrote:

> I have typical scenario in which the both current running process and the
> interrupt handler shared the some buffer. when the current running process
> is running in kernel mode and accessing the buffer. during that time the
> interrupt has arrived. How the operating system(linux) is going to handle
> this scenario?

Shared resource must be protected with spinlocks (either basic or
read-write spinlock, depending upon the situation or the access to
shared resource). Spinlock disables the local interrupts and provides
the synchronization across other CPu by its lock variable.

On UP (uni processor) machine, interrupts will never occur whenever
you are holding the spinlock, so current process (which is in critical
section) will never be interrupted till the time it comes out of
critical section.

On SMP machine, Interrupts will not occur on local CPU, but can occur
on other CPU. Interrupt handler will be executed on other CPU and will
keep on spining till the time the current process on local CPU does
not come out of spinlock and realese the spinlock. That is why its imp
to use the spinlocks only where the scritical section is too short and
in which we are sure we are not going to sleep or in other words not
going to give away the CPU.

Hope it clears.
Cheers !!
Gaurav


>
> Thanks
>
> Manjunath
>


--
--
-Gaurav
Email: gauravd.chd@xxxxxxxxx
---------------------------------
Read my blog at: http://lkdp.blogspot.com/
---------------------------------

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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