+ -
当前位置:首页 → 问答吧 → linux init进程的问题

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这里是干什么用来
菜得一坨的鸟,求指教~~

作者: 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          */

又发错区了。。。。。。。

作者: tempname2   发布时间: 2010-09-01

翻到这个帖子,也许有用

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

作者: 梅川内依酷   发布时间: 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




    不好意思,新来的,不知道发到哪
看到一个linux的,却是安装系统,编译内核什么的,就发到这儿了

作者: kitifaye   发布时间: 2010-09-01

相关阅读 更多

热门下载

更多