You are on page 1of 11

PROCESSOR MANAGEMENT

 Physical Processor and Logical Processor


 Interrupts and interrupt handling

 Interrupt handling in IBM-PC


Physical Processor and Logical Processor
Interrupts and interrupt handling
Address Memory
100 Main program CPU
Interrupt procedure:
101 - Identify the source.
- Forbid other
102
interrupts?
- Save the contents of Input
the registers.
- Link to interrupt Interrupt A
procedure.
- - Restore registers.
- Allows interrupt
- Back to the main
program

1000 Serve interrupt A


Commands to be
1001
executed for interrupt A
1002
Backtracking
Requirements of an interrupt system

 Defines a set of events that are likely to cause an interrupt


 There is a means of recording the situations (context) when an interrupt
occurs, usually one or several flag bits.
 The CPU must perform the interrupt status check periodically.
 The system must check to determine where the interrupt request came
from, and to decide whether to allocate a CPU to fulfill that interrupt
request.
 Locate inside the CPU, to store information about the cause of the
interrupt.
 If the interrupt request needs to be met, the CPU must jump to the
corresponding interrupt server program or procedure.
 Within the operating system, interrupts are often used to access kernel
services (the operating system kernel).
Types of interrupts
 Supervisor call interrupt
 occurs when a process issues an instruction that requests a procedure
within the operating system.
 Internal interrupt
 soft interrupt
 generated by certain events, inside the handler that is executing those
events
 For example, when a program malfunctions
 External interrupt
 hard interrupt
 is generated outside the processor that is taking the interrupt, usually
by other processors or input/output devices in the system.
The interrupt clock
 Preventing users from monopolizing the system
 Ensure reasonable response time for multi-user
system
 Prevents system crashes when a user is executing
an infinite loop
Multi interrupt Bộ điều khiển ngắt X

Bộ điều khiển ngắt Y

Chương trình
người dùng
(a) Tiến hành ngắt tuần tự

Bộ điều khiển ngắt X

Bộ điều khiển ngắt Y

Chương trình
người dùng
(b) Tiến hành ngắt lồng (nested)
Example: Handling interrupt has priority

Serve Serve interrupt of


User program interrupt of communication
Printer
t=0
t = 15
t = 10

t = 25

t = 40

t = 25

Serve interrupt
of Disk
t = 35
Interrupt handling in IBM-PC
 Interrupt 00h: divide 0
 Interrupt 01h: execute each command
 Interrupt 02h: NMI (unshaded interrupt)
 Interrupt 03h: Stop
 Interrupt 04h: Overflow error
 Interrupt 05h: Hard Copy (PrtScr)
 Interrupt 06h-07h: not in use
 Interrupt 08h -0Fh: These interrupts are generated by
the interrupt 8259 controller
The interrupt 8259 controller
 There are 8 sources that generate interrupts (devices)
simultaneously
 Each device is assigned a priority

Chiều tăng của mức ưu tiên


7 6 5 4 3 2 1 0 bit
Bộ điều khiển ngắt (địa chỉ 20h)

Bộ thời gian
Bàn phím
COM 2
COM 1
Đĩa mềm
Máy in song song
Interrupt requests on the AT machine

Chiều tăng của mức ưu tiên


7 6 5 4 3 2 1 0 bit
Bộ điều khiển ngắt (địa chỉ 20h)

7 6 5 4 3 2 1 0 bit

Đồng xử lý toán học


Thời gian thực
Chiều tăng của mức ưu tiên

You might also like