1 / 16

Lecture 26 I/O Systems II

Lecture 26 I/O Systems II. Application I/O Interface. I/O system calls encapsulate device behaviors in generic classes We discuss structuring techniques and interfaces for the operating system that enable I/O devices to be treated in a standard, uniform way

Download Presentation

Lecture 26 I/O Systems II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 26I/O Systems II M.B. Ibáñez

  2. Application I/O Interface • I/O system calls encapsulate device behaviors in generic classes • We discuss structuring techniques and interfaces for the operating system that enable I/O devices to be treated in a standard, uniform way • The approach involves abstraction, encapsulation, and software layering M.B. Ibáñez

  3. Block-device interface • The block device interface captures all the aspects necessary for accessing disk drivers and other block-oriented devices (disks, tapes) • They store information in blocks that are usually fixed size, and transfers are made a block at a time • The device understands commands such as read and write • If it is a random-access device, it has a seek command to specify which block to transfer next M.B. Ibáñez

  4. Character-stream interface • The basic system calls in this interface enable an application to get or put one character • On top of this interface, libraries can be built that offer line-at-a-time access, with buffering and editing services • Convenient for • input devices such as keyboards, mice, and modems • output devices such as printers or audio boards M.B. Ibáñez

  5. Network Devices • Network I/O differ significantly from disk I/O • One interface that is available in many operating systems is the network socket interface • The system calls in the socket interface enable an application to • Create a socket • Connect a local socket to a remote address • Listen for any remote application to plug into the local socket • Send and receive packets over the connection M.B. Ibáñez

  6. Clocks and Timers • Most computers have hardware clocks and timers that provide three basic functions • Give the current time • Give the elapsed time • Set a timer to trigger operation O at time T M.B. Ibáñez

  7. Blocking System Call • When an application issues a blocking system call, the execution of the application is suspended • The application is moved from the OS’s run queue to a wait queue • After the system call completes, the application is moved back to the run queue, where it is eligible to resume execution, at which time it will receive the values returned by the system call M.B. Ibáñez

  8. Non blocking (asynchronous) I/O • Examples of non-blocking I/O • User interface that receives keyboard and mouse input while processing and displaying data on the screen • A video application that reads frames from a file on disk while simultaneously decompressing and displaying the output on the display • An asynchronous call returns immediately, without waiting for the I/O to complete. The application continues to execute its code, and the completion of the I/O at some future time is communicated to the application M.B. Ibáñez

  9. I/O scheduling • To schedule a set of I/O requests means to determine a good order in which to execute them • Scheduling can improve overall system performance, can share access fairly among processes, and can reduce the average waiting time for I/O to complete M.B. Ibáñez

  10. Buffering • A buffer is a memory area that stores data while they are transferred • between two devices • or between a device and an application • Buffering is done for three reasons • To cope with a speech mismatch between the producer and the consumer of a data stream • To adapt between devices that have different data-transfer sizes • To support copy semantics for application I/O M.B. Ibáñez

  11. No Buffering Operating System User Process In I/O Device No buffering From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall M.B. Ibáñez

  12. Operating System User Process In Move I/O Device Single buffering Single Buffer • Operating system assigns a buffer in main memory for an I/O request • Block-oriented • input transfers made to buffer block moved to user space when needed • another block is moved into the buffer • read ahead • From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall M.B. Ibáñez

  13. Single Buffer • Block-oriented • user process can process one block of data while next block is read in • swapping can occur since input is taking place in system memory, not user memory • operating system keeps track of assignment of system buffers to user processes • output is accomplished by the user process writing a block to the buffer and later actually written out From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall M.B. Ibáñez

  14. Single Buffer • Stream-oriented • used a line at time • user input from a terminal is one line at a time with carriage return signaling the end of the line • output to the terminal is one line at a time • From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall M.B. Ibáñez

  15. Operating System User Process Move In I/O Device Double buffering Double Buffer • Use two system buffers instead of one • A process can transfer data to or from one buffer while the operating system empties or fills the other buffer • From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall M.B. Ibáñez

  16. Operating System User Process In Move . I/O Device . Circular buffering Circular Buffer • More than two buffers are used • Each individual buffer is one unit in a circular buffer • Used when I/O operation must keep up with process • From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall M.B. Ibáñez

More Related