jrj317的个人空间 https://www.eechina.com/space-uid-9104.html [收藏] [复制] [分享] [RSS]

博客

KERNEL THREADS

已有 1969 次阅读2011-4-10 08:11 |

KERNEL THREADS

Freezer
Upon entering a suspended state the system will freeze all
tasks. This is done by delivering pseudosignals. This affects
kernel threads, too. To successfully freeze a kernel thread
the thread has to check for the pseudosignal and enter the
refrigerator. Code to do this looks like this:
 do {
  hub_events();
  wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list));
  if (current->flags & PF_FREEZE)
   refrigerator(PF_FREEZE);
 } while (!signal_pending(current));
from drivers/usb/core/hub.c::hub_thread()

The Unfreezable
Some kernel threads however, must not be frozen. The kernel must
be able to finish pending IO operations and later on be able to
write the memory image to disk. Kernel threads needed to do IO
must stay awake. Such threads must mark themselves unfreezable
like this:
 /*
  * This thread doesn't need any user-level access,
  * so get rid of all our resources.
  */
 daemonize("usb-storage");
 current->flags |= PF_NOFREEZE;
from drivers/usb/storage/usb.c::usb_stor_control_thread()
Such drivers are themselves responsible for staying quiet during
the actual snapshotting.

路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

关于我们  -  服务条款  -  使用指南  -  站点地图  -  友情链接  -  联系我们
电子工程网 © 版权所有   京ICP备16069177号 | 京公网安备11010502021702
返回顶部