DOC PREVIEW
CU-Boulder CSCI 3753 - Device Management

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Device ManagementAnnouncementsDetermining When I/O is CompleteControl Unit with Interrupt (Hardware)Examples of Exceptions in Pentium SystemsThe Trap Instruction OperationSlide 7Maskable InterruptsDisabling Maskable InterruptsClasses of System Calls Invoked by trapThe Device Driver InterfaceDevice Management OrganizationDevice System Call InterfaceExample: BSD UNIX DriverDevice Independent Function CallOverlapping the Operation of a Device and the CPUOverlapping CPU-Controller Operations in a ProcessOverlapping Processing and I/ODevice Manager I/O StrategiesPolling I/O Read OperationInterrupt-driven I/O OperationDriver-Kernel InterfaceDMA with Interrupts ExampleHandling InterruptsHandling Interrupts(2)Operating Systems: A Modern Perspective, Chapter 5Slide 5-1Copyright © 2004 Pearson Education, Inc.5DeviceManagementOperating Systems: A Modern Perspective, Chapter 5Slide 5-2Copyright © 2004 Pearson Education, Inc.Announcements•Homework Set #1 due Thursday 11 am, see moodle•copyright issues with lectures•Program Assignment #1 coming soon•Read chapters 4 and 5–skip sections 4.7, 4.8–skip Sections 5.4, 5.5 for nowOperating Systems: A Modern Perspective, Chapter 5Slide 5-3Copyright © 2004 Pearson Education, Inc.Determining When I/O is CompleteCPUCPUDeviceDeviceDeviceDeviceDeviceDeviceInterrupt Pending• CPU incorporates an “interrupt pending” flag• When device.busy  FALSE, interrupt pending flag is set• Hardware “tells” OS that the interrupt occurred• Interrupt handler part of the OS makes process ready to runOperating Systems: A Modern Perspective, Chapter 5Slide 5-4Copyright © 2004 Pearson Education, Inc.Control Unit with Interrupt (Hardware)PC = <machine start address>;IR = memory[PC];haltFlag = CLEAR;while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest) { memory[0] = PC; PC = memory[1]};memory[1] contains the address of the interrupt handlercouldbe atrapinstr.Operating Systems: A Modern Perspective, Chapter 5Slide 5-5Copyright © 2004 Pearson Education, Inc.Examples of Exceptions in Pentium SystemsClass Cause Async/SyncReturn behaviorTrap Intentional exceptionSync always returns to next instructionFault Potentially recoverable errorSync might return to current instructionAbort nonrecover-able errorSync never returnsInterrupt signal from I/O deviceAsync always returns to next instructionOperating Systems: A Modern Perspective, Chapter 5Slide 5-6Copyright © 2004 Pearson Education, Inc.The Trap Instruction Operation SModeTrustedCodetrapUser SupervisorBranch Table231a trap is a “software” interrupthardware interrupts behave similarly, an interrupt gives an offset into interrupt vector tableOperating Systems: A Modern Perspective, Chapter 5Slide 5-7Copyright © 2004 Pearson Education, Inc.Examples of Exceptions in Pentium SystemsException NumberDescription Exception Class0 Divide error fault13 General protection faultfault14 Page fault fault18 machine check abort32-127 OS-defined Interrupt or trap128 System call Trap129-255 OS-defined Interrupt or trapException Table, also called Branch Table orJump Table or Interrupt VectorOSassignsmaskableinterruptsnon-maskableOperating Systems: A Modern Perspective, Chapter 5Slide 5-8Copyright © 2004 Pearson Education, Inc.Maskable Interrupts•Maskable interrupts can be turned off by CPU before execution of critical instruction sequences–are used by device controllers to talk with CPU•Nonmaskable interrupts/exceptions is reserved for events such as unrecoverable memory errors and cannot be turned off by the CPU•Can have multiple interrupt priority levels–high-priority interrupts can preempt execution of a low-priority interruptOperating Systems: A Modern Perspective, Chapter 5Slide 5-9Copyright © 2004 Pearson Education, Inc.Disabling Maskable InterruptssaveProcessorState() { for(i=0; i<NumberOfRegisters; i++) memory[K+i] = R[i]; for(i=0; i<NumberOfStatusRegisters; i++) memory[K+NumberOfRegisters+i] = StatusRegister[i];}PC = <machine start address>;IR = memory[PC];haltFlag = CLEAR;while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest && InterruptEnabled) { disableInterupts(); memory[0] = PC; PC = memory[1]};have to reenableinterrupts after doneOperating Systems: A Modern Perspective, Chapter 5Slide 5-10Copyright © 2004 Pearson Education, Inc.Classes of System Calls Invoked by trap•end, abort•load, execute•create, terminate•get attributes, set•wait for time•wait event, signal event•allocate memory, freeProcesscontrolComm-unicationsFileManagementDeviceManagementInformationManagementsystem call interface•request device, release•read, write, reposition•get attributes, set•logically attach or detach devices•create connection, delete•send messages, receive•transfer status info•attach remote devices, detach•create, delete•open, close•read, write, reposition•get attributes, set•get time/date, set•get system data, set•get process, file, or device attributes, setNoteSimilarityOperating Systems: A Modern Perspective, Chapter 5Slide 5-11Copyright © 2004 Pearson Education, Inc.The Device Driver InterfaceDevice InterfaceDevice Interface…write(…);…TerminalDriverTerminalDriverPrinterDriverPrinterDriverDiskDriverDiskDriverTerminalControllerTerminalControllerPrinterControllerPrinterControllerDiskControllerDiskControllerOperating Systems: A Modern Perspective, Chapter 5Slide 5-12Copyright © 2004 Pearson Education, Inc.Device Management OrganizationApplicationProcessApplicationProcessFileManagerFileManagerDevice ControllerCommandCommandStatusStatusDataDataHardware InterfaceSystem InterfaceDevice-IndependentDevice-IndependentDevice-DependentDevice-Dependente.g. write()Device Manageror I/O SubsystemdriversOperating Systems: A Modern Perspective, Chapter 5Slide 5-13Copyright © 2004 Pearson Education, Inc.Device System Call Interface•Functions available to application programs•Abstract all devices (and files) to a few interfaces•Make interfaces as similar as possible–Block vs character–Sequential vs direct/random access–Blocking versus Non-Blocking I/O•blocking system call: process put on wait queue until I/O completes•non-blocking system call: returns immediately with partial number of bytes transferred, e.g. keyboard, mouse, network sockets–Synchronous versus


View Full Document

CU-Boulder CSCI 3753 - Device Management

Download Device Management
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Device Management and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Device Management 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?