Re: Regarding Interrupt processing

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

 




On Fri, 1 Aug 2003, Senthil Kumar R wrote:

> Hi,
> If my task P is currently executing in the CPU and if an interrupt occurs during that time, I understand that there will be a context switch and the interrupt service routine will be executed in the Kernel's context.
> 
> Once the interrupt service routine is over, 
> will my task P gets to the CPU 
> (Assuming P has its time slice yet to finish)
> or 
> will the scheduler take control?

My understanding is as follows:


Depends.
The need_schedule flag of the process will be checked.
If set , the scheduler is called. If not set, the current process is
continued.

Lets follow the code.

in /include/asm/hw_irq.h
interrupt handlers are registered with these.
there are various macros (starting with BUILD_)
An important one is BUILD_COMMON_IRQ that calls do_irq that eventually jumps
to ret_from_intr.

ret_from_intr is a label in 
 arch/i386/kernel/entry.S

which tests if the process is returning to user-mode or virtual-86 mode.

If so, it jumps to jmp_with_reschedule which tests the need_reschedule flag in
the task_struct.

if this is a kernel process that was interrupted, scheduler is not called
(jmp to ret_with_reschedule is not made and kernel chugs along.

Specifically, if the process has time slice left , it should continue merrily.



Hope this help.

Somebody, please correct me if I was wrong.
Thanks.

Vijay Subramanian

--
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