Linux0.11内核分析三之进程调度

xiaoxiao2021-02-28  114

Linux进行进程调度一般有两种情况 1.允许进程运行的时间结束 2.进程的运行停止 比如当进程阻塞时需要等待外设提供数据 或者等待其他程序的运行结果 这时就会进行进程调度 这里是执行for(;;) pause(); 最终执行到schedule()函数切换到其他进程运行 这里切换到进程1

Linux创建了进程1 后开始进行进程调度

static inline _syscall0(int,pause) void main(void) /* This really IS void, no error here. */ { ... if (!fork()) { /* we count on this going ok */ 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(); ... }

接下来是循环的运行pause() 函数 pause()也是系统调用 系统调用的过程和fork open类似 都是通过调用unistd.h的syscall0 通过int 0x80中断 在system_call.s的call _sys_call_table(,

转载请注明原文地址: https://www.6miu.com/read-48899.html

最新回复(0)