Lecture No 29/11/2019CS330 Operating System1
Topics to be covered❖Interrupts❖Operating System Task❖Computer Organization9/11/2019CS330 Operating System2
3Hardware interrupts❖When interrupt occurs, hardware does the following: ➢CPU is interrupted▪at that time application code or kernel code might be running▪registers and the program counter saved in RAM to preserve CPU state➢CPU starts running the respective Interrupt Service Routing (ISR) ▪(kernel routine)▪ISR is found through interrupt vector ▪(table containing addresses of ISRs)9/11/2019CS330 Operating System
4Software interrupts❖Running application software may generate interrupts as well. ➢They are called software interrupts (also called traps)1.exceptions (caused by errors)2.system calls (service request)trapor syscallinstruction is used❖An operating system (kernel) is interrupt-driven (event driven)9/11/2019CS330 Operating System
Interrupt-Driven OS9/11/2019CS330 Operating System5Kernel CodeDevicesApplications or System Programs running in CPUhardware interruptsoftware interrupt / trap(due to system service requestsor errors)disk, keyboard, timer, network adapter…
Interrupt Handling❖The operating system preserves the state of the CPU by storing registers and the program counter❖Determines which type of interrupt has occurred:➢polling➢vectoredinterrupt system❖Separate segments of code determine what action should be taken for each type of interruptRegisterCPURAMStores[Application in CPU]-interrupt-[Service Routine in CPU]
8Direct Memory Access Structure❖With DMA, device controller transfers blocks of datafrom buffer storage directly to main memory without CPU intervention➢Only one interrupt is generated per block, rather than the one interrupt per byteDevice ControllerMain MemoryCPUDMA Controller Transfer9/11/2019CS330 Operating System
I/O Structure❖After I/O starts, control returns to user program only upon I/O completion➢Wait instruction idles the CPU until the next interrupt➢Wait loop (contention for memory access)➢At most one I/O request is outstanding at a time, no simultaneous I/O processing❖After I/O starts, control returns to user program without waiting for I/O completion➢System call –request to the OS to allow user to wait for I/O completion➢Device-status table contains entry for each I/O device indicating its type, address, and state➢OS indexes into I/O device table to determine device status and to modify table entry to include interrupt
10How a modern computer works9/11/2019CS330 Operating System
Computer System Architecture
12Storage Structure❖Main memory–CPU can access directly❖Secondary storage–extension of main memory that provides large nonvolatile storage capacity➢Magnetic disks ▪platters▪The disk controllerdetermines the interaction between the device and the computerSpinningDiskDisk ControllerMainMemoryCPUsecondary storage9/11/2019CS330 Operating System
You've reached the end of your free preview.
Want to read all 38 pages?
- Spring '19
- Interrupt, Computer data storage