main.c中rest_init()函数的问题
时间:2010-09-01
来源:互联网
本帖最后由 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过,找了好多贴子也没搞懂 内核线程这个东西与进程是什么区别
请这里的高人讲解一下,发一些这方面的资料也行,谢谢!
各位大侠,新来的很多不懂,勿怪~~
这个问题先前错发到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过,找了好多贴子也没搞懂 内核线程这个东西与进程是什么区别
请这里的高人讲解一下,发一些这方面的资料也行,谢谢!
作者: kitifaye 发布时间: 2010-09-01
顾名思义,内核线程的守护线程。
运行在内核空间的线程的守护线程。
运行在内核空间的线程的守护线程。
作者: linyunxian 发布时间: 2010-09-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28