Re: how many "contexts" are there?

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

 



AFAIK, those three contexts that you mentioned are indeed the only contexts that an 'instruction' can be in. If you look at the top-voted answer on the stackoverflow question that you cited, it explains how a kernel thread executes kernel instructions in a process context. The idea of a 'thread' in Linux is very similar to that of a process. In fact, every 'thread' _is_ a process. Just that a 'thread'/'process' happens to share some resources with other threads/process (ex. stack, text section etc.). 

A kernel thread in addition has _no_ user-space addresses. The 'mm' pointer (which points to the user-space addresses of a process) is set to NULL for kernel threads. That is okay, because kernel threads are _not_ supposed to execute/access anything that might belong to a process/lies in user-space.
 
For details, refer Linux Kernel Dev. by Robert Love.

~Gaurav  

On Mon, Oct 8, 2012 at 12:42 PM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:

  the standard explanation of context related to linux is that there
are three "contexts" one can be in at any time:

  * user context
  * kernel, process context
  * kernel, interrupt context

but that's clearly(?) an incomplete (or not refined enough) list,
since it doesn't include kernel threads, and a quick google showed
this:

http://stackoverflow.com/questions/9389688/in-what-context-kernel-thread-runs-in-linux

  so is there a more refined or up-to-date list of contexts which
explains them fairly well, including the subtle distinctions?  thanks.

rday

--

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



--
Gaurav Jain
Associate Software Engineer
VxVM Escalations Team, SAMG
Symantec Software India Pvt. Ltd.



_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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