MIT6_004s09_lec19

MIT6_004s09_lec19 - MIT OpenCourseWare http:/ocw.mit.edu...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
MIT OpenCourseWare http://ocw.mit.edu For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms . 6.004 Computation Structures Spring 2009
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
L19 – Devices & Interrupts 1 6.004 – Spring 2009 4/16/09 Devices & Interrupts Lab #6 due tonight! Loop: LD(R3,0,R0) ADDC(R3,4,R3) SUBC(R2,1,R2) BNE(R2,Loop) (Cough) Excuse me, sir… modified 4/13/09 10:14 L19 – Devices & Interrupts 2 6.004 – Spring 2009 4/16/09 Why an OS? What we’ve got: ± A Single Sequence Machine, capable of doing ONE thing at a time – one instruction, one I/O operation, one program. ± A universe of gadgets – e.g. I/O devices – that do similar things slightly differently. What we’d like: ± To listen to MP3s while reading email. ± To access disk, network, and screen “simultaneously”. ± To write a single program that does I/O with anybody’s disk. Plausible approaches: ± An infinite supply of identical computers with uniform, high-level peripherals for every conceivable purpose… or ± An illusion: Make one real computer look like many “virtual” ones. L19 – Devices & Interrupts 3 6.004 – Spring 2009 4/16/09 Operating Systems An OS is the Glue that holds a computer together. - Mediates between competing requests - Resolves names/bindings - Maintains order/fairness KERNEL - a RESIDENT portion of the O/S that handles the most common and fundamental service requests. vir.tu.al \'v*rch-(*-)w*l, 'v*r-ch*l\ \.v*r-ch*-'wal-*t-e-\ \'v*rch-(*-)w*-le-, 'v*rch-(*-)le- \ aj [ME, possessed of certain physical virtues, fr. ML virtualis, fr. L virtus strength, virtue : being in essence or effect but not in fact - vir.tu.al.i.ty n Hardware Registers ALUs PCs Caches Kernel Operating System Applications Device Drivers Scheduler Process Control Blocks (PCBs) Shared Libraries Word Processors Graphical User Interface (GUI) Games Spread Sheets Web Browser Page Tables Device Queues Network Interfaces Security File system I/O Devices L19 – Devices & Interrupts 4 6.004 – Spring 2009 4/16/09 OS organization “Applications” are quasi-parallel “PROCESSES” on “VIRTUAL MACHINES”, each with: ± CONTEXT (virtual address space) ± Virtual I/O devices O.S. KERNEL has: ± Interrupt handlers ± SVC (trap) handlers ± Scheduler ± PCB structures containing the state of inactive processes Scheduler KERNEL P1 P2 SVC 1 handler SVC 0 handler I/O Handler Device 0 Alarm Clock I/O Handler Device 1 DPYNum=0 DPYNum=1 PCBs: P1: P2: loop:SVC(0) ... SVC(1) ... BR(loop) loop:SVC(0) ... SVC(1) ... BR(loop)
Background image of page 2
L19 – Devices & Interrupts 5 6.004 – Spring 2009 4/16/09 Asynchronous I/O Handling SVC call from application Application: ReadKey() | read key into R0 . . . “A” Device Buffer (in OS Kernel) KEYhit_h() { (read ASCII code, put in buffer) } INTERRUPT from Keyboard n INTERRUPT to OS IN OUT ReadKEY_h() { (remove next char from buffer, return in R0) …} TRAP to OS IN OUT L19 – Devices & Interrupts 6 6.004 – Spring 2009 4/16/09 Interrupt-based Asynchronous I/O struct Device { char Flag, Data; } Keyboard; KEYhit_h() { Buffer[inptr] = Keyboard.Data; inptr = (inptr + 1) % BUFSIZE; } OPERATION: NO a±ention to Keyboard during normal operation
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/07/2011 for the course COMPUTER S 6.004 taught by Professor Staff during the Spring '09 term at MIT.

Page1 / 7

MIT6_004s09_lec19 - MIT OpenCourseWare http:/ocw.mit.edu...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online