Events
• After the OS has booted, all entry to the kernel happens as the result
of an event
• event immediately stops current execution
• changes mode to kernel mode, event handler is called
• An event is an “unnatural” change in control flow
• Events immediately stop current execution
• Changes mode, context (machine state), or both
• The kernel defines a handler for each event type
• Event handlers always execute in kernel mode
• The specific types of events are defined by the machine
• In effect, the operating system is one big event handler
OS Control Flow
• When the processor receives an event of a given type, it
• transfers control to handler within the OS
• handler saves program state (PC, registers, etc.)
• handler functionality is invoked
• handler restores program state, returns to program
Categorizing Events
• Two kinds of events, interrupts and exceptions
• Exceptions are caused by executing instructions
• CPU requires software intervention to handle a fault or trap
• Interrupts are caused by an external event
• Device finishes I/O, timer expires, etc.
• Two reasons for events, unexpected and deliberate
• Unexpected events are, well, unexpected
• What is an example?
• Deliberate events are scheduled by OS or application
• Why would this be useful?
This gives us a convenient table:
• Terms may be used slightly differently by various OSes,
CPU architectures…
• No need to “memorize” all the terms
• Software interrupt – a.k.a. async system trap (AST), async
or deferred procedure call (APC or DPC)
• Will cover faults, system calls, and interrupts next
Faults
• Hardware detects and reports “exceptional” conditions
• Page fault, divide by zero, unaligned access
• Upon exception, hardware “faults” (verb)
• Must save state (PC, registers, mode, etc.) so that the faulting
process can be restarted
• Fault exceptions are a performance optimization
• Could detect faults by inserting extra instructions into code
(at a significant performance penalty
เหตุการณ์
- หลัง OS มี booted ทั้งหมดเข้า kernel เกิดขึ้นเป็นผลของเหตุการณ์
-
- เหตุการณ์หยุดทันที ปัจจุบันการเปลี่ยนแปลงโหมดโหมดเคอร์เนล , สถานที่เกิด เรียกว่า
- เหตุการณ์ที่เป็น " ธรรมชาติ " การเปลี่ยนแปลงในการควบคุมแต่ละเหตุการณ์การหยุดทันที
-
การเปลี่ยนแปลงในปัจจุบัน โหมด บริบท ( สภาพเครื่อง ) หรือทั้งสอง
- เคอร์เนลกำหนดผู้ดูแลแต่ละเหตุการณ์ประเภท
- งานจัดการเสมอรันในโหมดเคอร์เนล
- ชนิดที่เฉพาะเจาะจงของเหตุการณ์ถูกกำหนดโดยเครื่อง
- ผล ระบบปฏิบัติการเป็นหนึ่งเหตุการณ์ใหญ่ผู้ดูแล
O
- การควบคุมการไหล เมื่อประมวลผลได้รับกรณีระบุชนิด , ควบคุมการรับส่งบริการเพื่อการจัดการ
บริการภายในระบบปฏิบัติการ ผู้ดูแลจะบันทึกสถานะรายการ ( PC , ทะเบียน , ฯลฯ )
-
จะเรียกผู้ดูแลการทํางาน- เจ้าหน้าที่รัฐกลับคืนโปรแกรมโปรแกรม
- แยกแยะเหตุการณ์สองชนิดของเหตุการณ์ การขัดจังหวะและข้อยกเว้น
- ข้อยกเว้นที่เกิดจากการแนะนํา
- CPU ต้องมีการแทรกแซงซอฟต์แวร์เพื่อจัดการกับความผิดหรือกับดัก
-
ขัดจังหวะที่เกิดจากเหตุการณ์ภายนอกเสร็จสิ้น - อุปกรณ์ I / O เวลาหมดอายุ ฯลฯ
- สองเหตุผลสำหรับเหตุการณ์ที่ไม่คาดคิดและโดยเจตนา
- เหตุการณ์ไม่คาดคิด , ดี , ที่ไม่คาดคิด
- อะไรคือตัวอย่าง ? การกำหนดโดยเหตุการณ์
-
- OS หรือโปรแกรมทำไม นี้เป็นประโยชน์ นี้จะช่วยให้เราสะดวก
แต่ละตารางเงื่อนไขอาจใช้แตกต่างกันเล็กน้อย โดย oses ต่างๆ
- CPU สถาปัตยกรรม . . . . . . . ไม่ต้อง " ท่องจำ " เงื่อนไขทั้งหมด
- ซอฟต์แวร์และระบบการขัดจังหวะหรือกับดัก ( AST ) , Async
หรือเลื่อนการเรียกกระบวนการ ( APC หรือ DPC )
- จะครอบคลุมถึงข้อบกพร่อง ระบบโทรศัพท์ และขัดจังหวะต่อไป
- ของฮาร์ดแวร์ตรวจจับและรายงาน " พิเศษ " เงื่อนไข
- หน้าผิด หารด้วยศูนย์ unaligned เข้าถึง
- ตามข้อยกเว้น ฮาร์ดแวร์ " ความผิดพลาด " ( กริยา )
- ต้องบันทึกสถานะ พีซี , ทะเบียน , โหมด ฯลฯ ) เพื่อให้สามารถเริ่มต้นใหม่
ตลอดกระบวนการ- เพิ่มประสิทธิภาพการปฏิบัติผิดข้อยกเว้น
- สามารถตรวจหาความผิดโดยการใส่คำสั่งพิเศษในรหัส
( ที่สำคัญงานลงโทษ
การแปล กรุณารอสักครู่..
