加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – TASK_KILLABLE和TASK_INTERRUPTIBLE有什么区别?

发布时间:2020-12-14 00:34:47 所属栏目:Linux 来源:网络整理
导读:似乎TASK_KILLABLE应该是TASK_INTERRUPTIBLE的一个子集,因为杀死一个任务是一种方式,嗯,打断它;但是,根据sched.h here和 here,它看起来像TASK_KILLABLE是UNINTERRUPTIBLE. #define TASK_INTERRUPTIBLE 1#define TASK_UNINTERRUPTIBLE 2#define TASK_WAKEKILL
似乎TASK_KILLABLE应该是TASK_INTERRUPTIBLE的一个子集,因为杀死一个任务是一种方式,嗯,打断它;但是,根据sched.h here和 here,它看起来像TASK_KILLABLE是UNINTERRUPTIBLE.

#define TASK_INTERRUPTIBLE      1
#define TASK_UNINTERRUPTIBLE    2
#define TASK_WAKEKILL           128
#define TASK_KILLABLE           (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)

这真正归结为我的是;我什么时候想使用wait_for_completion_interruptible_timeout而不是wait_for_completion_killable_timeout?

解决方法

事实证明,更多的搜索为我解答了这个问题: this somewhat related answer中提到的 article:

Kernel code which uses interruptible sleeps must always check to see whether it woke up as a result of a signal,and,if so,clean up whatever it was doing and return -EINTR back to user space. The user-space side,too,must realize that a system call was interrupted and respond accordingly; not all user-space programmers are known for their diligence in this regard.

many of these concerns about application bugs do not really apply if the application is about to be killed anyway. It does not matter if the developer thought about the possibility of an interrupted system call if said system call is doomed to never return to user space. So Matthew created a new sleeping state,called TASK_KILLABLE; it behaves like TASK_UNINTERRUPTIBLE with the exception that fatal signals will interrupt the sleep

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读