linux – TASK_KILLABLE和TASK_INTERRUPTIBLE有什么区别?

linux – TASK_KILLABLE和TASK_INTERRUPTIBLE有什么区别?,第1张

概述似乎TASK_KILLABLE应该是TASK_INTERRUPTIBLE的一个子集,因为杀死一个任务是一种方式,嗯,打断它;但是,根据sched.h here和 here,它看起来像TASK_KILLABLE是UNINTERRUPTIBLE. #define TASK_INTERRUPTIBLE 1#define TASK_UNINTERRUPTIBLE 2#define TA 似乎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

总结

以上是内存溢出为你收集整理的linux – TASK_KILLABLE和TASK_INTERRUPTIBLE有什么区别?全部内容,希望文章能够帮你解决linux – TASK_KILLABLE和TASK_INTERRUPTIBLE有什么区别?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/yw/1023855.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存