interrupts

52
Interrupts oslecture02

Upload: jasper-browning

Post on 31-Dec-2015

44 views

Category:

Documents


3 download

DESCRIPTION

Interrupts. oslecture02. Interrupts. CPU มี interrupts pin สำหรับรับสัญญาณขัดจังหวะ ( interrupt signals ) จาก ฮาร์ดแวร์ โดยเมื่อมีอินเตอร์รัพท์เกิดขึ้นมาจากฮาร์ดแวร์ เข็มที่ซี พียูจะทำการเปลี่ยนค่า และบอกซีพียูว่ามีสัญญาณอินเตอร์รัพท์เกิดขึ้น ดังรูป. Interrupts (ต่อ). - PowerPoint PPT Presentation

TRANSCRIPT

Interrupts

Interruptsoslecture02

InterruptsCPU interrupts pin ( interrupt signals )

Interrupts ()

The IVToslecture02The IVT interrupts pin 1 ? The IVT () PIC PIC PIC PIC The IVT ()

Running the ISRoslecture02Running the ISR ?

?Running the ISR () PIC IVT IP ISR Running the ISR (2) 1 1 PIC ( 1) IVT 1 IP ISR IVT 1Return to original program ISR ? RET ISR IRET VocabularyISR interrupt service routine IVT interrupt vector table IRET interrupt return RET return (from normal subroutine) PIC programmable interrupt controller IP instruction pointer CPU central processing unit RAM random access memory

Summary of processing an interrupt (1) PICPIC ID PIC CPU CPU Summary of processing an interrupt (1)CPU CPU ID ( IRQ) PIC PICCPU IP = IVT [IRQ]Summary of processing an interrupt (2)ISR ISR IRETCPU

Dual-Mode Operationoslecture02Dual-Mode Operation 2 privileged mode user mode privileged mode user mode I/O , Dual-Mode Operation () privileged mode ISR user mode user mode Software Interruptsoslecture02Software Interrupts PIC 21 system call MS-DOSSoftware Interrupts () traps system call system call open(), read(), write(), close(), seek(), ioctl(), kill(), fork(), c library, system call CPU Hogs context switch system call CPU Hogs () ISR , ISR 0 CPU Processes , , Process Control Block(PCB)Context Switchoslecture02Context Switchcontext switch context switch ISR PCB PCBContext Switch () IRET user mode ? 0 I/O 1

ISR 1 PCB

Scheduler chooses new process 2

ISR 2 PCB 1

ISR IRET 2

Process Scheduling system call I/O ? FIFO ConceptsHardware Interrupt & PICSoftware Interrupt Process & PCB Context switch System call Dual-mode operation CPU state

oslecture02Process StatesProcess States 1 PCB

Running Blocked for I/O I/O I/OReady to run Process State Diagram

Process State Diagram () I/O ready oslecture02Priority queuesPriority queues 3 FIFO

Priority queues ()

Priority queues () I/O 1 1 MS-Windows I/O ready queue, Priority queues ()Logical view of a process code segment, data segment, stack segment heap segment PCB

The code segment (CS) The data segment (DS) The stack segment (SS)

Logical view of a process ()Heap segment (HS) Process control block (PCB) 4 PCB linked list base address

Logical view of a process ()Old-style segmentation 808x 1MB BIOS, IVT 640 KB 64KB segment register 64 KB memory segment segment offset segment segment offset segment array 2

Old-style segmentation () segment offset 1 segment

Old-style segmentation ()VocabularyFIFO First In First Out Segmentation 2 segment offset 0