Ketan Mukadam wrote:
On 7/10/05, Deepak Joshi <deepak_cins@xxxxxxxxxxx> wrote:
Hi all,
I read one statement in LDD in 6th chapter about
interrupt.
"The current pointer is not valid in interrupt mode
and can't be used".
I am not able to get it. Can anybody plz explain me
what author want to convey by using above statement.
In linux kernel, the variable "current" points to the task structure
of the current process running. When an interrupts occurs, then the
kernel switches to interrupt mode which does not fall under current
process context. So even though the value of variable "current" might
point to a valid task structure, it should not be used since there is
no current process running.
Just to add, hardware interrupts are asynchronous. They can occur at any
time, so you cannot depend onwhat the currently running process is. For
example, arrival of a packet at the network interface is totally
independent of the currently running process. so, while current is
available to you, it doesn't make too much sense to use it because on
the next occurence of the interrupt, current maybe pointing somewhere else!
-rahul
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/