了解前提: 《汇编: asm函数》
3特权级是普通进程
0特权级是内核级进程
// 计算机中有了一个名副其实的3特权级的进程0,第一项工作fork创建进程1
if (!fork()) { /* we count on this going ok */ //fork返回值1 ,不执行 init
init();
}
/*
* NOTE!! For any other task 'pause()' would mean we have to get a
* signal to awaken, but task0 is the sole exception (see 'schedule()')
* as task 0 gets activated at every idle moment (when no other tasks
* can run). For task0 'pause()' just means we go check if some other
* task can run, and if not we return here.
*/
for(;;) pause();
// fork函数实际上执行的是 unistd.h中的宏函数 syscall0 中去版权声明:本文为yexiangCSDN原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。