调度程序代码在什么上下文中运行? [英] What context does the scheduler code run in?

查看:66
本文介绍了调度程序代码在什么上下文中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在两种情况下调用调度程序代码schedule()-

There are two cases where the scheduler code schedule() is invoked-

  1. 当进程自动调用schedule()

定时器中断调用schedule()

在情况2中,我认为schedule()在中断上下文中运行,但是第一种情况呢?它是否在调用它的进程的上下文中运行?

In case 2, I think schedule() runs in interrupt context, but what about the first case? Does it run in the context of the process which invoked it?

还有其他调用schedule()的方案吗?

Also are there any more scenarios which invoke schedule()?

推荐答案

schedule()始终在进程上下文中运行.在第二种情况下,当它由计时器中断启动时,它位于从内核返回被调用schedule()的被中断进程的返回路径中.

schedule() always runs in process context. In the second case, when it is initiated by a timer interrupt, it is in the return path back from the kernel to the interrupted process where schedule() is called.

这篇关于调度程序代码在什么上下文中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆