RE: Premptive vs non-premptive kernel.

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

 



Hi Amith,

Answer for your second question:

need_resched is not something specific to a particular process and is
not a part of task_struct, its global to kernel and is set by timer
interrupt whenever the timer interrupt finds that the time allocated to
current process (represented by 'current' pointer) has expired.

Your first question is my question also, How the returning code of any
interrupt finds whether the control is returning to user space or kernel
space? As far as I think, it must be checking if the return address
falls in kernel address range or in user address range. Can someone give
the detailed insight about this?

Regards,
Gaurav Dhiman.


-----Original Message-----
From: kernelnewbies-bounce@nl.linux.org
[mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of amith
Sent: Friday, June 25, 2004 12:07 PM
To: Robert Love
Cc: Gaurav Dhiman; KERNEL; Nagaraj S
Subject: Re: Premptive vs non-premptive kernel.

Robert Love wrote:

>A couple corrections:
>
>The timer interrupt does the timeslice check as you describe in the
same
>manner, whether or not CONFIG_PREEMPT is enabled.  It simply sets the
>need_resched flag.
>
>The actual preemption occurs when the timer interrupt returns (it
>actually occurs when any interrupt returns).  If need_resched is set,
>the interrupt handler will invoke the scheduler to choose a new task.
>

 >    "if need_resched is set" -  when executing in kernel mode , if an 
interrupt occurs, the ISR is called ,  once ISR is executed , where is 
need_resched set ?, and how does the ISR know the process context where 
the CPU was executing earlier i.e to set need_resched in the 
corresponding task_struct ?

 > "the interrupt handler will invoke the scheduler to choose a new 
task"  does the timer ISR have the process context of the process which 
got interrupted , if no , then how is need_reched set for the 
interrupted process ?

cheers,
Amith




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



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