L19-4up

L19-4up - L19 – Devices & Interrupts 1 6.004 – Fal...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: L19 – Devices & Interrupts 1 6.004 – Fal 2010 11/16/10 Devices & Interrupts Lab #7 due Thursday Loop: LD(R3,0,R0) ADDC(R3,4,R3) SUBC(R2,1,R2) BNE(R2,Loop) … (Cough) Excuse me, sir… L19 – Devices & Interrupts 2 6.004 – Fal 2010 11/16/10 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 di ff erently. What we ’ d like: • To listen to MP3s while reading email. • To access disk, network, and screen l simultaneously z . • 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 l virtual z ones. Wizard of OS L19 – Devices & Interrupts 3 6.004 – Fal 2010 11/16/10 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 – Fal 2010 11/16/10 OS organization l Applications z are quasi-parallel l PROCESSES z on l VIRTUAL MACHINES z , 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 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) L19 – Devices & Interrupts 5 6.004 – Fal 2010 11/16/10 Asynchronous I/O Handling SVC call from application Application: … GetKey() | read key into R0 … . . . l A z Device Bu ff er (in OS Kernel) KEYhit_h() { (read ASCII code, put in bu ff er) } INTERRUPT from Keyboard n INTERRUPT to OS IN OUT ReadKEY_h() { (remove next char from bu ff er, return in R0) …} TRAP to OS IN OUT L19 – Devices & Interrupts 6 6.004 – Fal 2010 11/16/10 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...
View Full Document

This document was uploaded on 03/07/2011.

Page1 / 6

L19-4up - L19 – Devices & Interrupts 1 6.004 – Fal...

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

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