4059056 发表于 2015-06-21 14:24

请教上下文的含义

在ULK88页中,有一句话是这么说的:
能被独立调度的每个执行上下文都必须拥有它自己的进程描述符;

想问 上下文 是什么意思,在很多文章中见过很多次,就是不理解

请高手指点!!!

Dannysd 发表于 2015-06-21 21:43

翻译的差异吧

进程上下文其实就是在内核空间,内核代表用户进程执行(比如从磁盘读数据)这时候就说进程处于上下文中

个人理解,仅供参考

firocu 发表于 2015-06-22 11:08

本帖最后由 firocu 于 2015-06-22 11:09 编辑

个人理解:

上下文对应英文的context, 字面意思就是在一起的结构, 注意text是texture的缩写, 有层次, 前后的潜在意思.

按照wikipedia的解释, 通常context说的都是 task context.
In computer science, a task context is the minimal set of data used by a task (which may be a process or thread) that must be saved to allow a task interruption at a given date, and a continuation of this task at the point it has been interrupted and at an arbitrary future date.

注意这里面的minimal set这个词, 一个进程运行需要很多内容, 包括cpu registers , memory, disk等等.
但构成上下文的只是很小的集合:
The context data may be located in processor registers, memory used by the task, or in control registers used by some operating systems to manage the task.

在我看来就是, 一些cpu的寄存器, 还有内核和进程相关的数据结构task_struct里面的thread_struct之类的数据.

除此之外, 还有interrupt context.也是类似的意思.

个人理解, FIXME!
页: [1]
查看完整版本: 请教上下文的含义