cpsc 410 611 week 8
play

CPSC 410/ 611: Week 8 I / O Har dwar e I / O Applicat ion I nt er - PDF document

CPSC 410 / 611 : Operating Systems CPSC 410/ 611: Week 8 I / O Har dwar e I / O Applicat ion I nt er f ace I / O Subsyst em I ssues Note : much mat erial in t his set of slides comes direct ly f rom Solomon&Russinovich,


  1. CPSC 410 / 611 : Operating Systems CPSC 410/ 611: “Week 8” • I / O Har dwar e • I / O Applicat ion I nt er f ace • I / O Subsyst em I ssues Note : much mat erial in t his set of slides comes direct ly f rom Solomon&Russinovich, “I nside Windows 2000,” Microsof t Programming Series. I / O Devices graphics keyboard mass storage CPU mouse printer memory modem network 1

  2. CPSC 410 / 611 : Operating Systems Where is t he Cont rol of I / O Funct ions? • Processor direct ly cont rols device. • Cont roller or I / O module is added. Processor uses programmed I / O wit hout int er r upt s. • Same, but wit h int errupt s. • The I / O module is given direct cont rol of memory via DMA. • I / O module is separat e processor, wit h special inst ruct ion set and access t o memory t o execut e I / O program. No CPU int ervent ion. • I / O module has local memory of it s own. Can cont r ol sever al I / O devices. • I nt elligent I / O (I 2 O). • Dat a-near comput at ion: port ions of applicat ions are migrat ed t o I / O cont rollers. • TCP of f load: Run prot ocols on net work int erf ace card. • TAMU-PANI C (Prot ocols Aboard Net work I nt erf ace Cards) proj ect : port ions of applicat ion run in net work int erf ace cards. I O Syst em Component s (Windows 2k) Win32 Applications services user-mode setup WMI PnP service components manager .inf files user mode .cat files registry kernel mode I/O system WDM WMI PnP Power I/O routines manager manager manager drivers ... HAL 2

  3. CPSC 410 / 611 : Operating Systems W2k Primary Device Driver Rout ines dispatch dispatch routines dispatch start I/O routines routines routine add-device IO interrupt routine system service routine In addition: initialization DPC routine routine I/O completion routines Cancel I/O routine Unload routine System shutdown notification routine Error-logging routine W2k I / O Dat a St ruct ures • File Obj ect s: Handles t o f iles or devices. • Driver Obj ect s: Represent individual driver in t he syst em. I / O Manager has ref erences t o Dispat ch Rout ines. • Device Obj ect s: Represent physical or logical devices in t he syst em. Cont ain all inf ormat ion about device charact erist ics, buf f er locat ions, et c. 3

  4. CPSC 410 / 611 : Operating Systems W2k File Obj ect s Filename I dent if ies t he physical f ile t hat t he f ile obj ect r ef er s t o Current byt e of f set I dent if ies t he current locat ion of t he f ile (valid only f or synchronous I / O) Share modes I ndicat e whet her ot her callers can access t he f ile while t he cur r ent caller is using it . Open mode f lags I ndicat e whet her I / O will be synchronous or asynchronous, cached or non-cached, sequent ial or random, et c. Point er t o device obj ect Point er t o volume paramet er I ndicat es t he volume, or part it ion, t hat t he f ile block resides on. Point er t o sect ion obj ect I ndicat es a root st ruct ure t hat describes a point ers mapped f ile. Point er t o pr ivat e cache map I dent if ies which par t of t he f ile ar e cached by t he cache manager Opening a File Obj ect (W2k) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 4

  5. CPSC 410 / 611 : Operating Systems Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series W2k I / O Dat a St ruct ures (simple I / O r equest ) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 5

  6. CPSC 410 / 611 : Operating Systems Windows Driver Model (WDM) Drivers • Bus Drivers manage logical or physical bus (PCMCI A, PCI , USB, I EEE 1394, I SA). I nt erf aces t o – PnP Manager -- t o det ect and inf orm about devices at t ached t o bus. – Power Manager -- t o cont rol power set t ings of devices on bus. • Function Drivers manage part icular t ype of device. Export s operat ional int erf ace of device. • Filter Drivers logically layer above or below f unct ion drivers. – Augment or modif y behavior of device or anot her driver. Device Driver Layering Environment subsystem or DLL 1. NtWriteFile(file_handle, char_buffer) System Services 2. Write data at specified I/O byte offset within a file manager File system driver 3. Transfer file-relative byte offset into a disk-relative byte offset and call next driver (via I/O manager) disk driver 4. Call driver to write data at disk-relative byte offset 5. Translate disk-relative byte offset into physical location and transfer data. 6

  7. CPSC 410 / 611 : Operating Systems Device Driver Layering Environment subsystem or DLL 1. NtWriteFile(file_handle, char_buffer) System Services 2. Write data at specified I/O byte offset within a file manager File system driver 3. Transfer file-relative byte offset into a disk-relative byte offset and call next driver (via I/O manager) 4. Call next driver to write data at disk-relative byte offset Volume manager disk driver 5. Transfer disk-relative byte offset into disk number and offset, and call next driver (via I/O manager) 6. Call next driver to write data to disk 3 at disk-relative byte disk driver offset 5. Translate disk-relative byte offset into physical location and transfer data. W2k I / O Processing • Types of I / O • I / O Cont rol Flow 7

  8. CPSC 410 / 611 : Operating Systems Cont rol Flow f or an I O Operat ion Application Call ReadFile() ReadFile Call NTReadFile() Kernel32.dll return to caller NtReadFile INT 2E Ntdll.dll return to caller User mode Kernel mode KiSystemService Call NTReadFile() Ntoskrnl.exe dismiss interrupt NtReadFile Whether to wait depends Invoke driver Ntoskrnl.exe dismiss interrupt on overlapped flag Initiate I/O operation Driver.sys dismiss interrupt Queuing and Complet ing a Synchr onous Request Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 8

  9. CPSC 410 / 611 : Operating Systems Ser vicing a Device I nt er r upt (only Phase I ) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series Servicing a Device I nt errupt (Phase I I ) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 9

  10. CPSC 410 / 611 : Operating Systems Complet ing an I / O Request (Phase I ) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series Complet ing an I / O Request (Phase I I ) Figure from Solomon&Russinovich, “Inside Windows 2000,” Microsoft Programming Series 10

  11. CPSC 410 / 611 : Operating Systems I ssues: Thread Cont rol • Too f ew t hreads: lack of concurrency. • Too many t hread: scheduler pressure, t hread t hrashing • W2k: Complet ion Port s I ssues: Buf f ering operating system user process no buffering single buffering double buffering circular buffering 11

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend