是否可以从内核空间阻止任务? [英] Is it possible to block a task from kernel space?
本文介绍了是否可以从内核空间阻止任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有办法从内核空间阻止用户空间任务?内核中已经有为此功能了吗?我试图看一下,但到目前为止没有发现任何明显的东西.
I'm wondering if there's a way to block a userspace task from kernel space? Is there a function already in the kernel for this? I have tried to look but found nothing obvious so far.
推荐答案
在UP中,这非常简单:将任务的状态设置为TASK_INTERRUPTIBLE
并调用schedule()
.您可以稍后通过将其状态设置为TASK_RUNNING
来恢复".
In UP, this is quite simple: set the state of the task to TASK_INTERRUPTIBLE
and call schedule()
. You can "resume" it later by setting its state to TASK_RUNNING
.
在SMP中,您必须确保任务不在另一个CPU上运行.
In SMP, you have to make sure that the task is not running on another CPU.
这篇关于是否可以从内核空间阻止任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文