Thread (2 messages) 2 messages, 2 authors, 2012-10-08

how many "contexts" are there?

From: Gaurav Jain <hidden>
Date: 2012-10-08 16:24:11

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 [off-list ref]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 at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


-- 
Gaurav Jain
Associate Software Engineer
VxVM Escalations Team, SAMG
Symantec Software India Pvt. Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121008/7391d39c/attachment.html 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help