ELDD读书笔记:第三章 内核组件
来源:互联网 发布:中国软件重组预期 编辑:程序博客网 时间:2024/06/15 15:59
ELDD读书笔记:第三章 内核组件
- ELDD读书笔记第三章 内核组件
- 内核线程
- 1 创建内核线程
- 2 进程状态和等待队列
- 3 用户模式辅助程序
- 辅助接口
- 1链表
- 2散列链表
- 3工作队列
- 4通知链
- 5完成接口
- 6kthread辅助接口
- 7错误处理助手
- 查看源代码
- 内核线程
0 内核线程
[1] 创建内核线程
【代码清单3-1】实现内核线程 P39static DECLARE_WAIT_QUEUE_HEAD(myevent_waitqueue);rwlock_t myevent_lock;extern unsigned int myevent_id;/* Holds the identify of the troubled data structure.Populated later on */static int mykthread(void *unused){ unsigned int event_id = 0; DECLARE_WAITQUEUE(wait,current); /* Become a kernel thread without attached user resources */ daemonize("mythread"); /* Request delivery of SIGKILL */ allow_signal(SIGKILL); /* The thread sleeps on this wait queue until it's woken up by parts of the kernel in charge of sensing the health of data structure of interest */ for(;;) { /* Relinquish the processor until the event occurs */ set_current_state(TASK_INTERRUPTIBLE); schedule();/* Allow other parts of the kernel to run*/ /* Die if I receive SIGKILL */ if(signal_pending(current)) break; /* Control gets here when the thread is woken up */ read_lock(&myevent_lock);/* Critical section ends */ if(myevent_id) { event_id = myevent_id; read_unlock(&myevent_lock);/* Critical section ends */ /*Invoke the registered user mode helper and pass the identify code in its environment*/ run_umode_handler(event_id);/* Expanded later on */ } else { read_unlock(&myevent_lock); } } set_current_state(TASK_RUNING); remove_wait_queue(&myevent_waitqueue,&wait); return 0;}
[2] 进程状态和等待队列
[3] 用户模式辅助程序
1 辅助接口
[1]链表
[2]散列链表
[3]工作队列
[4]通知链
[5]完成接口
[6]kthread辅助接口
[7]错误处理助手
2 查看源代码
阅读全文
0 0
- ELDD读书笔记:第三章 内核组件
- ELDD读书笔记:第四章 基本概念
- ELDD读书笔记:第十章 PCI
- ELDD读书笔记:第五章 字符设备驱动程序
- ELDD读书笔记:第六章 串行设备驱动程序
- ELDD读书笔记:第七章 输入设备驱动程序
- ELDD读书笔记:第八章 I2C协议
- 《深入理解Linux内核》--第三章 进程:读书笔记
- WINDOWS核心编程--读书笔记:第三章 内核对象
- 《深入理解Linux内核》读书笔记-第三章-进程(1)
- 《深入理解Linux内核》读书笔记-第三章-进程(2)
- 《深入理解Linux内核》读书笔记-第三章-进程(1) .
- 《深入理解Linux内核》读书笔记-第三章-进程(2) .
- 深入linux设备驱动程序内核机制(第三章) 读书笔记
- 深入理解linux内核读书笔记(第三章)
- 《Linux内核完全剖析》读书笔记——第三章 内核编程语言和环境
- 深入理解linux内核(第三版)-读书笔记
- 读书笔记_第三章
- CSS伪类
- dedecms织梦cms被挂马 /plus/90sec.php 的修复问题
- 一些基本的排序算法(正在修改)
- tomcat中文乱码问题
- 延时加载
- ELDD读书笔记:第三章 内核组件
- ssm maven oracle各路大神的博文
- 小程序提交form表单
- 扫雷游戏问题
- Glide使用过程中遇到得那些坑
- 第14周 项目2
- Java中的线程池(2)----FixedThreadPool
- JAVA第九次作业(2)
- java.lang.String cannot be cast to java.lang.Integer