RE: Non Preemptive Kernel.

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

 




Hi,

Iam no expert on this , but I guess when an interrupt occurs both CS(code segment selector) and the eip(Instruction pointer) are stored on the Kernel mode stack. Since the Privilige level of the CS(which are 2 bits of the CS register, I guess it is the 13th and the 14th bit) of the CS register is different from the privilege level of the Kernel Mode CS register, the kernel knows that a change of prvilige level is taking place and hence it knows that it is returning to the Userspace.
I am talking about the x86 architecture. The kernel is at Privilege level 0 and the User programs operate at privilige level of 3. Again I would like to say that Iam not sure that this is how it happens.

Thanks,
Sajay

P.S : If this is wrong Iam sorry.





"Dhiman, Gaurav" <Gaurav.Dhiman@ca.com>

06/25/2004 05:20 PM

       
        To:        "Jan Hudec" <bulb@ucw.cz>, <sajay@temenos.com>
        cc:        <kernelnewbies@nl.linux.org>
        Subject:        RE: Non Preemptive Kernel.




Can you tell us, how the retuirn code of interrupt identifies if the
control is returning to kernel space or user space. I mean how it comes
to know that interrupt occurred in kernel space or user space. What
exactly the returning code on any interrupt checks for this.

Regards,
Gaurav


-----Original Message-----
From: kernelnewbies-bounce@nl.linux.org
[mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Jan Hudec
Sent: Friday, June 25, 2004 1:24 PM
To: sajay@temenos.com
Cc: kernelnewbies@nl.linux.org
Subject: Re: Non Preemptive Kernel.

On Fri, Jun 25, 2004 at 10:56:31 +0530, sajay@temenos.com wrote:
> Hi,
>
> I have a doubt in the Non Preemptive Kernel. In the case of a Non
> Preemptive Kernel, the Kernel Control Path cannot be preempted unless
it
> relinquishes the CPU Voluntarily. In this scenario, supposing a Timer
> interrupt occurs, how does the timer Interrupt handler find out that a

> Kernel Control Path is running and hence the process shouldn't be
> preempted. Or is this handled by the schedule() function.

It does not. IIRC schedule happens during return to userspace. Return to
userspace does not happen if the interrupt interrupted kernel code. And
note, that it really happens during EACH return to userspace (if
need_resched is set), so if interrupt causes process to wake up, it's
scheduled soon.

------------------------------------------------------------------------
-------
                                                                                                      Jan 'Bulb' Hudec
<bulb@ucw.cz>



[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