全面解析Linux 内核 3.10.x - 启动1号进程

本文深入解析Linux内核3.10.x,重点讨论在MIPS架构下,内核如何启动1号进程,包括初始化调度系统、创建祖先进程、设置进程抢占及进入内核等待状态等关键步骤。作者Keven强调坚持的重要性。
摘要由CSDN通过智能技术生成

From: 全面解析Linux 内核 3.10.x - 本文章完全基于MIPS架构

坚持也许就是胜利 - Keven

当内核找到文件系统以后(这里已经挂载proc文件系统了),内核的主要启动使命就越来越少了。因为江山基本已经打下了,剩下的就是要坐江山了。来看下面的这段代码。

static noinline void __init_refok rest_init(void)
{
    int pid;

    rcu_scheduler_starting();
    /*
     * We need to spawn init first so that it obtains pid 1, however
     * the init task will end up wanting to create kthreads, which, if
     * we schedule it before we create kthreadd, will OOPS.
     */
    kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
    numa_default_policy();
    pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
    rcu_read_lock();
    kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
    rcu_read_unlock();
    complete(&kthreadd_done);

    /*
     * The boot idle thread must execute schedule()
     * at lea
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值