内核在哪里存储未运行的进程?

发布于 2024-11-03 01:15:49 字数 202 浏览 4 评论 0原文

大家我对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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半城柳色半声笛 2024-11-10 01:15:49

处于 TASK_INTERRUPTIBLETASK_UNINTERRUPTIBLE 状态的进程进一步细分为不同的类,每个类对应一个特定的事件。在此状态下,进程状态无法提供足够的信息来快速检索进程描述符,因此使用另一个名为 wait_queue 的进程列表。 Wait_queue 实现事件的条件等待。等待特定事件的进程被放置在适当的等待队列中。

等待队列被实现为循环列表,其元素包括指向进程的指针
描述符。等待队列列表的每个元素都是 wait_queue 类型:

struct wait_queue {  
    struct task_struct * task;  
    struct wait_queue * next;  
}; 

Processes in a TASK_INTERRUPTIBLE or TASK_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 called wait_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:

struct wait_queue {  
    struct task_struct * task;  
    struct wait_queue * next;  
}; 
相守太难 2024-11-10 01:15:49

等待队列用于使进程能够等待特定事件的发生 - 例如等待键盘输入。

wait queues are used to enable processes to wait for a particular event to occur - such as waiting for input from a keyboard.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文