How To Create a kernel thread
2016-03-05 00:07
441 查看
kernel_thread() --> do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, pregs, 0, NULL, NULL);
The CLONE_VM flag avoids the duplication of the page tables of the calling process: this duplication would be a waste of time and memory, because the new kernel thread will not access the User Mode address space anyway.
The CLONE_UNTRACED flag ensures that no process will be able to trace the new kernel thread, even if the calling process is being traced.
The kernel_thread() function builds up the Kernel Mode Stack area ,so that:
• The ebx and edx registers will be set by copy_thread() to the values of the parameters fn and arg, respectively.
• The eip register will be set to the address of the following assembly language fragment:
movl %edx,%eax pushl %edx call *%ebx pushl %eax call do_exit
Therefore, the new kernel thread starts by executing the fn(arg) function. If this function terminates, the kernel thread executes the _exit() system call passing to it the return value of fn().
From:《Understanding The Linux Kernel》3rd Edition.
相关文章推荐
- POJ 2125 Destring the Graph(网络流)
- Delphi -- 创建 桌面、发送到...、快速启动栏、开始菜单、程序菜单、右键菜 单
- 你所不知的 CSS ::before 和 ::after 伪元素用法
- java加密解密___des的简单实现
- 字符串操作及相关函数(万一的博客,51篇)
- HBase Shell常用命令
- 利用html迂回实现可编辑的下拉框(select)
- codeforces 631B B. Print Check
- Android Studio中如何创建自己的库?
- 虚拟机上的redhat6连网g
- GetVersionEx被声明为已否决
- 45. Jump Game II
- 2016-3-4
- 夜谈程序员的职业生涯规划
- 跑动Kmeans
- Python发送form-data请求及拼接form-data内容的方法
- 使用Python保存网页上的图片或者保存页面为截图
- Zend Framework教程之视图组件Zend_View用法详解
- Zend Framework实现Zend_View集成Smarty模板系统的方法
- Zend Framework动作助手(Zend_Controller_Action_Helper)用法详解