免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2871 | 回复: 6
打印 上一主题 下一主题

异常或者自陷与进程context [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-02-11 13:53 |只看该作者 |倒序浏览
刚才看到一篇文章中有这么一段话"中断或者异常或者自陷等,从概念上说,此时没有进程context,不能进行context switch。"  中断是异步的,没有进程context可以理解,异常和自陷是同步的,应该有进程context。 没理解,请大家帮我分析分析!

论坛徽章:
0
2 [报告]
发表于 2009-02-11 15:09 |只看该作者
异常处理和自陷的时候是会发生进程切换的.

论坛徽章:
0
3 [报告]
发表于 2009-02-11 15:20 |只看该作者
原帖由 scutan 于 2009-2-11 15:09 发表
异常处理和自陷的时候是会发生进程切换的.


异常处理的时候是不允许发生进程切换的。

论坛徽章:
0
4 [报告]
发表于 2009-02-11 16:01 |只看该作者
原帖由 xpl 于 2009-2-11 15:20 发表


异常处理的时候是不允许发生进程切换的。


经常碰到的缺页异常, 在执行时, 内核就可以挂起当前进程, 而切换到另外的进程去.

论坛徽章:
0
5 [报告]
发表于 2009-02-11 17:00 |只看该作者
原帖由 scutan 于 2009-2-11 16:01 发表


经常碰到的缺页异常, 在执行时, 内核就可以挂起当前进程, 而切换到另外的进程去.


你能确定是“切换到另外的进程”吗?

论坛徽章:
0
6 [报告]
发表于 2009-02-11 17:56 |只看该作者
原帖由 xpl 于 2009-2-11 17:00 发表


你能确定是“切换到另外的进程”吗?


Assuming that the kernel is bug free, most exceptions can occur only while the CPU is in User Mode. Indeed, they are either caused by programming errors or triggered by debuggers. However, the "Page Fault " exception may occur in Kernel Mode. This happens when the process attempts to address a page that belongs to its address space but is not currently in RAM. While handling such an exception, the kernel may suspend the current process and replace it with another one until the requested page is available. The kernel control path that handles the "Page Fault" exception resumes execution as soon as the process gets the processor again.


另外, 系统调用也是一种异常, 在执行它的时候也可以发生进程切换的啊.

另外在ULK第五章第一节也有一句话:
The above rules tell us that the kernel can be preempted only when it is executing an exception handler (in particular a system call) and the kernel preemption has not been explicitly disabled.

论坛徽章:
0
7 [报告]
发表于 2009-02-12 11:46 |只看该作者
原帖由 scutan 于 2009-2-11 17:56 发表


Assuming that the kernel is bug free, most exceptions can occur only while the CPU is in User Mode. Indeed, they are either caused by programming errors or triggered by debuggers. However, th ...


Sure, I made a mistake.

Exception is synchronization.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP