DEVICE-STATUS TABLE device:card reader 1 status:idle device:line printer 3 request for status:busy line printer address:38546 device:disk unit 1 length:1372 status:idle device:disk unit 2 status:idle device:disk unit 3 status:busy request for request for disk unit 3 disk unit 3 file:xxx file:yyy operation:read operation:write address:43046 address:03458 length:20000 length:500
DEVICE-STATUS TABLE
DIRECT MEMORY ACCESS STRUCTURE o Used for high-speed I/O devices able to transmit information at close to memory speeds. o Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention. o Only one interrupt is generated per block,rather than the one interrupt per byte
DIRECT MEMORY ACCESS STRUCTURE Used for high-speed I/O devices able to transmit information at close to memory speeds. Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention. Only one interrupt is generated per block, rather than the one interrupt per byte
According to program counter(PC)'s value, PC+1 fetch the instruction,decode and run NO Interrupt occur? 单 Check the type of interrupt Store the values of PC and PSW. Reset the values of PC and PSW according to the corresponding values in the Interrupt Vector table Execute interrupt handling program Finish handling interrupt,restore the values of PC and PSW
OPERATING-SYSTEM OPERATIONS o Interrupt driven by hardware 0 Software error or request creates exception or trap Division by zero,request for operating system service o Other process problems include infinite loop,processes modifying each other or the operating system o Dual-mode operation allows Os to protect itself and other system components User mode and kernel mode Mode bit provided by hardware o Provides ability to distinguish when system is running user code or kernel code o Some instructions designated as privileged,only executable in kernel mode o System call changes mode to kernel,return from call resets it to user
OPERATING-SYSTEM OPERATIONS Interrupt driven by hardware Software error or request creates exception or trap Division by zero, request for operating system service Other process problems include infinite loop, processes modifying each other or the operating system Dual-mode operation allows OS to protect itself and other system components User mode and kernel mode Mode bit provided by hardware Provides ability to distinguish when system is running user code or kernel code Some instructions designated as privileged, only executable in kernel mode System call changes mode to kernel, return from call resets it to user
TRANSITION FROM USER TO KERNEL MODE o Timer to prevent infinite loop process hogging resources* Set interrupt after specific period Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted time user process user mode user process executing calls system call return from system call (mode bit=1) trap return kernel mode bit =0 mode bit =1 kernel mode execute system call (mode bit=0) If you hog something,you take all of it in a greedy or impolite way
TRANSITION FROM USER TO KERNEL MODE Timer to prevent infinite loop / process hogging resources* Set interrupt after specific period Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to regain control or terminate program that exceeds allotted time * If you hog something, you take all of it in a greedy or impolite way. 独占