免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2850 | 回复: 1
打印 上一主题 下一主题

main.c中rest_init()函数的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-09-01 16:57 |只看该作者 |倒序浏览
本帖最后由 kitifaye 于 2010-09-01 16:58 编辑

各位大侠,新来的很多不懂,勿怪~~
这个问题先前错发到C版了,没怎么搞懂,再到这里发一下
求指点

最近在找一个问题不得不看到内核源码main.c(我是菜鸟~~)
在rest_init函数中
426 static noinline void __init_refok rest_init(void)
427         __releases(kernel_lock)
428 {
429         int pid;
430
431         rcu_scheduler_starting();
432         /*
433          * We need to spawn init first so that it obtains pid 1, however
434          * the init task will end up wanting to create kthreads, which, if
435          * we schedule it before we create kthreadd, will OOPS.
436          */
437         kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND); ------------------->1
438         numa_default_policy();
439         pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);------------------->2
440         rcu_read_lock();
441         kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
442         rcu_read_unlock();
443         complete(&kthreadd_done);
444
445         /*
446          * The boot idle thread must execute schedule()
447          * at least once to get things moving:
448          */
449         init_idle_bootup_task(current);
450         preempt_enable_no_resched();
451         schedule();
452         preempt_disable();
453
454         /* Call into cpu_idle with preempt disabled */
455         cpu_idle();
456 }

上面1处是创建1号init进程,求教2这里是干什么用来
菜得一坨的鸟,求指教~~

有位大仙让我 “内核线程,下一个准确理解的目标。”
先前自己google过,找了好多贴子也没搞懂 内核线程这个东西与进程是什么区别
请这里的高人讲解一下,发一些这方面的资料也行,谢谢!

论坛徽章:
0
2 [报告]
发表于 2010-09-02 22:38 |只看该作者
顾名思义,内核线程的守护线程。

运行在内核空间的线程的守护线程。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP