内核在哪里存储未运行的进程?
大家我对Linux中的任务有一些疑问,我知道当前处于状态TASK_RUNNING
的所有任务都在名为runqueue
的数据结构中,但是那些处于状态的任务呢?等待某个事件(不是 TASK_RUNNING 的状态,例如正在等待键盘输入的状态)。我是否有用于此类任务的其他数据结构或只有一般任务列表
?预先感谢您的任何解释
everyone I have some question about tasks in Linux, I know that all tasks which are currently at the state TASK_RUNNING
are in data structure called runqueue
, but what about the tasks which are waiting for some event (states which are not TASK_RUNNING, for example one which is waiting for the input from keyboard). Do I have some other data structure for such tasks or only general list of tasks
? thanks in advance for any explanation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
处于
TASK_INTERRUPTIBLE
或TASK_UNINTERRUPTIBLE
状态的进程进一步细分为不同的类,每个类对应一个特定的事件。在此状态下,进程状态无法提供足够的信息来快速检索进程描述符,因此使用另一个名为wait_queue
的进程列表。 Wait_queue 实现事件的条件等待。等待特定事件的进程被放置在适当的等待队列中。等待队列被实现为循环列表,其元素包括指向进程的指针
描述符。等待队列列表的每个元素都是 wait_queue 类型:
Processes in a
TASK_INTERRUPTIBLE
orTASK_UNINTERRUPTIBLE
state are further subdivided in to different classes, each of which corresponds to a specific event. In this state, the process state does not provide enough info to retrieve the process descriptor quickly, so another list of processes calledwait_queue
are used. Wait_queue implements conditional waits on events. A process waiting for a specific event is placed in the proper wait queue.Wait queues are implemented as cyclical lists whose elements include pointers to process
descriptors. Each element of a wait queue list is of type wait_queue:
等待队列用于使进程能够等待特定事件的发生 - 例如等待键盘输入。
wait queues are used to enable processes to wait for a particular event to occur - such as waiting for input from a keyboard.