Presentation is loading. Please wait.

Presentation is loading. Please wait.

I/O Systems Maciej Sałata 2006. I/O Systems PART I – Abstract aroach I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests.

Similar presentations

Presentation on theme: "I/O Systems Maciej Sałata 2006. I/O Systems PART I – Abstract aroach I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests."— Presentation transcript:

1 I/O Systems Maciej Sałata 2006

2 I/O Systems PART I – Abstract aroach I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance PART II – Real-life PC I/O hardware

3 PART I Abstract approach Based on Operating System Concepts by Avi Silberschatz, Peter Baer Galvin and Greg Gagne

4 I/O Hardware Incredible variety of I/O devices Common concepts Port Bus (daisy chain or shared direct access) Controller (host adapter) I/O instructions control devices Devices have addresses, used by Direct I/O instructions Memory-mapped I/O

5 A Typical PC Bus Structure

6 Device I/O Port Locations on PCs (partial)

7 Polling Determines state of device command-ready busy Error Busy-wait cycle to wait for I/O from device

8 Interrupts CPU Interrupt-request line triggered by I/O device Interrupt handler receives interrupts Maskable to ignore or delay some interrupts Interrupt vector to dispatch interrupt to correct handler Based on priority Some nonmaskable Interrupt mechanism also used for exceptions

9 Interrupt-Driven I/O Cycle

10 Direct Memory Access Used to avoid programmed I/O for large data movement Requires DMA controller Bypasses CPU to transfer data directly between I/O device and memory

11 Six Step Process to Perform DMA Transfer

12 Application I/O Interface I/O system calls encapsulate device behaviors in generic classes Device-driver layer hides differences among I/O controllers from kernel Devices vary in many dimensions Character-stream or block Sequential or random-access Sharable or dedicated Speed of operation read-write, read only, or write only

13 A Kernel I/O Structure

14 Characteristics of I/O Devices

15 Block and Character Devices Block devices include disk drives Commands include read, write, seek Raw I/O or file-system access Memory-mapped file access possible Character devices include keyboards, mice, serial ports Commands include get, put Libraries layered on top allow line editing

16 Blocking and Nonblocking I/O Blocking - process suspended until I/O completed Easy to use and understand Insufficient for some needs Nonblocking - I/O call returns as much as available User interface, data copy (buffered I/O) Implemented via multi-threading Returns quickly with count of bytes read or written

17 Blocking and Nonblocking I/O Asynchronous - process runs while I/O executes Difficult to use I/O subsystem signals process when I/O completed

18 Two I/O Methods Synchronous Asynchronous

19 Kernel I/O Subsystem Scheduling Some I/O request ordering via per-device queue Some OSs try fairness Buffering - store data in memory while transferring between devices To cope with device speed mismatch To cope with device transfer size mismatch To maintain copy semantics

20 Kernel I/O Subsystem Caching - fast memory holding copy of data Always just a copy Key to performance Spooling - hold output for a device If device can serve only one request at a time i.e., Printing Device reservation - provides exclusive access to a device System calls for allocation and deallocation Watch out for deadlock

21 Error Handling OS can recover from disk read, device unavailable, transient write failures Most return an error number or code when I/O request fails System error logs hold problem reports

22 I/O Protection User process may accidentally or purposefully attempt to disrupt normal operation via illegal I/O instructions All I/O instructions defined to be privileged I/O must be performed via system calls Memory-mapped and I/O port memory locations must be protected too

23 I/O Requests to Hardware Operations Consider reading a file from disk for a process: Determine device holding file Translate name to device representation Physically read data from disk into buffer Make data available to requesting process Return control to process

24 Life Cycle of An I/O Request

25 STREAMS STREAM – a full-duplex communication channel between a user-level process and a device in Unix System V and beyond A STREAM consists of: - STREAM head interfaces with the user process - driver end interfaces with the device - zero or more STREAM modules between them.

26 STREAMS Each module contains a read queue and a write queue Message passing is used to communicate between queues

27 The STREAMS Structure

28 Performance I/O a major factor in system performance: Demands CPU to execute device driver, kernel I/O code Context switches due to interrupts Data copying Network traffic especially stressful

29 Intercomputer Communications

30 Improving Performance Reduce number of context switches Reduce data copying Reduce interrupts by using large transfers, smart controllers, polling Use DMA Balance CPU, memory, bus, and I/O performance for highest throughput

31 PART II Real-life PC I/O hardware Based on various articles from Wikipedia

32 Drive interfaces Allow to communicate with disk/optical drives Short-ranged (with exceptions)

33 ATA (parallel) Developed in late 80s by Western Digital Integrated Drive Electronics (IDE) AT Attachment Packet Interface Bandwidth – up to 133 MB/s (UDMA-133)

34 SCSI Developed in 1986 Special controller needed Bandwidth – from 1.5 MB/s (SCSI 1) to 640 MB/s (Ultra-640 SCSI)

35 SATA Introduced in 2001 Hot-pluggable Natively supports command queueing Bandwidth – from 150 MB/s to 300 MB/s

36 Fibre Channel Used for SANs Despite its name, runs on copper twisted- pair cables too Topologies Point-to-point (vide ordinary ATA) Arbitrated loop (vide token ring) Switched fabric (vide ethernet)

37 System buses Used for communication with peripheral devices Allow to extend functionality High bandwidth

38 ISA (Industry Standard Arch.) Obsolete nowadays Bandwidth – from 4.77 MB/s (8-bit) to MB/s (16-bit)

39 PCI Bandwidth – 133 MB/s (32-bit/33MHz) up to 533 MB/s (64-bit/66MHz) Improvement – PCI-X

40 AGP Designed to cope with big throughput required by video cards Bandwidth – 266 MB/s (1x) up to 2133 MB/s (8x)

41 PCI-X (Extended) Connector physically identical to PCI Do not confuse with PCI Express Bandwidth – up to 4.27 GB/s

42 PCI Express Fast and robust Comes in many flavors – from 1x to 16x (250 MB/s – 8GB/s)

43 External interfaces Hot-pluggable (most of them) Allow further extension of functionality plus additional convenience of use

44 Serial Port (RS-232) Standard port used for serial communication, e.g.: Between a computer and a character device Between two computers Bandwidth – up to 115,200 bps

45 Parallel port Transmits several bits in parallel (as the name suggests) Omitted in modern computers Bandwidth – from 360 kBps to 2.5 MBps

46 PS/2 DIN/RS-232 replacement Not hot-pluggable Bandwidth – 40 kB/s Used for mice/keyboards

47 Universal Serial Bus 1.0 – about 0.2 MB/s 1.1 – 1.5 MB/s (Full-speed) 2.0 – 60 MB/s (High-speed) Power supply over bus

48 IEEE 1394 (FireWire, i.Link ) Similar to USB Bandwidth – up to 50 MB/s 1394b – 100 MB/s – 400 MB/s

49 The End Any questions?

Download ppt "I/O Systems Maciej Sałata 2006. I/O Systems PART I – Abstract aroach I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests."

Similar presentations

Ads by Google