linux init进程的问题
时间:2010-09-01
来源:互联网
本帖最后由 kitifaye 于 2010-09-01 10:09 编辑
最近在找一个问题不得不看到内核源码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这里是干什么用来
菜得一坨的鸟,求指教~~
最近在找一个问题不得不看到内核源码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这里是干什么用来
菜得一坨的鸟,求指教~~
作者: kitifaye 发布时间: 2010-09-01
/*
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 */
又发错区了。。。。。。。
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 */
又发错区了。。。。。。。
作者: tempname2 发布时间: 2010-09-01
翻到这个帖子,也许有用
http://linux.chinaunix.net/bbs/viewthread.php?tid=1019429&extra=&page=2
http://linux.chinaunix.net/bbs/viewthread.php?tid=1019429&extra=&page=2
作者: zzyong08 发布时间: 2010-09-01
回复 kitifaye
http://embexperts.com/viewthread ... =0&page=1#pid60
http://embexperts.com/viewthread ... =0&page=1#pid60
作者: 梅川内依酷 发布时间: 2010-09-01
内核线程,下一个准确理解的目标。
作者: zhangsuozhu 发布时间: 2010-09-01
QUOTE:
/*
433 * We need to spawn init first so that it obtains pid 1, however
434 * the ...
tempname2 发表于 2010-09-01 11:15
433 * We need to spawn init first so that it obtains pid 1, however
434 * the ...
tempname2 发表于 2010-09-01 11:15
不好意思,新来的,不知道发到哪
看到一个linux的,却是安装系统,编译内核什么的,就发到这儿了
作者: kitifaye 发布时间: 2010-09-01
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28