El Tue, Oct 06, 2009 at 12:33:22PM +0530 er krishna ha dit:
> I have a very basic confusion, please help and confirm the right answer :
>
> If a process/thread (user space/kernel space) has taken a lock on a
> critical section code, and suddenly an interrupt occurs which want to use
> the same shared data of critical region. Will it able to preempt this code
> which is running in process context ?
>
> As per my understanding, although interrupts has higher priority than
> process, but it can't preempt the process otherwise a major bug can occur
> ( depending upon the shared data of critical section). Please confirm my
> understanding weather its true or not ?
if you acquire the lock with spin_lock() instead of
spin_lock_irq[save]() the interrupt can preempt the process and
spin forever trying to acquire the lock. on the other hand
spin_lock_irq[save]() disables interrupts and you process won't be
preempted until it releases the lock.
--
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona
The book of nature is written in the language of mathematics
(Galileo Galilei)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ