Linux内核默认工作者线程的处理
来源:互联网 发布:企业一套表软件 编辑:程序博客网 时间:2024/05/29 16:21
摘至:http://www.makelinux.net/books/lkd2/ch07lev1sec4
Let's look at the heart of worker_thread(), simplified:
for (;;) { set_task_state(current, TASK_INTERRUPTIBLE); add_wait_queue(&cwq->more_work, &wait); if (list_empty(&cwq->worklist)) schedule(); else set_task_state(current, TASK_RUNNING); remove_wait_queue(&cwq->more_work, &wait); if (!list_empty(&cwq->worklist)) run_workqueue(cwq);}
This function performs the following functions, in an infinite loop:
The thread marks itself sleeping (the task's state is set to TASK_INTERRUPTIBLE) and adds itself to a wait queue.
If the linked list of work is empty, the thread calls schedule() and goes to sleep.
If the list is not empty, the thread does not go to sleep. Instead, it marks itselfTASK_RUNNING and removes itself from the wait queue.
If the list is nonempty, the thread calls run_workqueue() to perform the deferred work.
0 0
- Linux内核默认工作者线程的处理
- Linux内核移植 part4:内核线程对信号的处理
- 简单的工作者线程封装
- linux内核线程对信号的处理过程
- linux内核线程对信号的处理过程
- linux内核线程对信号的处理过程
- linux内核线程对信号的处理过程
- CLR线程池的工作者线程
- Linux 工作队列之工作者线程创建
- 工作者线程
- Linux内核线程中信号处理
- 关于Android中工作者线程的思考
- 关于Android中工作者线程的思考
- 关于Android中工作者线程的思考
- 关于Android中工作者线程的思考
- 关于Android中工作者线程的思考
- Linux内核中断底半部处理--内核微线程
- linux内核线程的创建
- HDU1025 Constructing Roads In JGShining's Kingdom
- 项目管理工具(测试必知)
- Equals的使用
- Ouath 2.0教程
- 七牛如何安装ios sdk (强烈建议试使用cocoapods安装)
- Linux内核默认工作者线程的处理
- 联合和枚举类型
- 关于dd指令镜像分区的一些使用体会
- 性能测试中如何确定并发用户数
- GIT远程获取分支
- 赫布理论
- 第3章 垃圾收集器与内存分配策略
- 本地更改登陆的SVN账号密码
- android 环境搭建