加州理工学院-计算系统导论 (33)
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Main Memory
Control Process
Prog Ctr Registers
Stack Data Code
Running
Text Editor
Prog Ctr Registers
Stack Data Code
Text Editor
Prog Ctr Registers
Stack Data Code
CS24: INTRODUCTION TO COMPUTATION
Spring 2013 Lecture 18
LAST TIME: OVERVIEW
¢ Expanded on our process abstraction ¢ A special control process manages
¢ Each process has a logical control flow
Sequence of instructions that the program executes
¢ Exceptional control flow is when logical flow is interrupted
Prog Ctr Registers
Stack Data Code
Running
Text Editor
Prog Ctr Registers
Stack Data Code
Text Editor
Prog Ctr Registers
Stack Data Code
IM Client
Prog Ctr Registers
Stack Data Code
Web Browser
Prog Ctr Registers
Stack Data Code
Email Client
Prog Ctr Registers
Stack Data Code
LAST TIME: OPERATING MODES
¢ Introduced processor operating modes
Enforce difference between “user” processes and the control process
¢ Applications run in “user mode” or “normal mode”
Can perform a limited subset of operations supported by the processor
all other processes
Uses the same process abstraction as other processes, but it can access and manipulate everything else
¢ Controller performs context-switches
IM Client
Prog Ctr Registers
Stack Data Codeቤተ መጻሕፍቲ ባይዱ
Web Browser
Prog Ctr Registers
Stack Data Code
Email Client
Prog Ctr Registers
Stack Data Code
EXCEPTIONAL CONTROL FLOW
Trap
Intentional exception
Always returns to next instruction
Fault
Potentially recoverable error Might return to current instruction
Abort
Nonrecoverable error
¢ When an exception occurs, handler is looked up in the Interrupt Descriptor Table
Suspend the currently running process, copy context to memory
Copy another process’ context into “running” area, then resume it
Main Memory
Control Process
Never returns
¢ Enables several capabilities:
Periodically, interrupt the current process and let the controller context-switch to another process
If a process misbehaves, the control process can step in and handle the situation (e.g. terminate the process)
Transfer control to an exception handler
¢ May or may not return to the interrupted program:
Interrupt Signal from IO device
Always returns to next instruction
¢ Control process runs in “kernel mode” or “protected mode”
Can use all processor capabilities
¢ Introduced the concept of an operating system
Intermediates between programs and hardware
IA32 AND EXCEPTIONAL CONTROL FLOW
¢ IA32 supports 256 different kinds of exceptions
0-31 are architecture-defined interrupts and exceptions
32-255 are user-defined exceptions, typically used for operating system entry-points, hardware support