how many "contexts" are there?

Gaurav Jain gjainroorkee at gmail.com
Mon Oct 8 12:24:11 EDT 2012


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 at crashcourse.ca>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 


More information about the Kernelnewbies mailing list