Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating.

Similar presentations


Presentation on theme: "Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating."— Presentation transcript:

1 Computer Studies (AL) I/O Management

2 Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating Systems Internals and Design Principles”, 2001, Prentice Hall

3 Content Overview Roles of device driver Spooling

4 Remark Polling, Interrupt, DMA, have already discussed in previous chapter. Please refer to the notes of interrupt handling.

5 Role of OS in I/O The role of the OS in computer I/O is to manage and control I/O operations and I/O devices Development direction of I/O-devices technology Standardization of software and hardware interface Variety of I/O devices

6 Device driver The basic I/O hardware elements, such as ports, buses and device controllers accommodate a wide variety of I/O devices. To encapsulate the details and oddities of different devices, the kernal of an OS is structured to use device-driver modules The device drivers present a uniform device- access interface to the I/O subsystem calls provide a standard interface between the application and the operating system

7 E.g. Remember I/O control layer? In layered file system, we have discussed I/O control layer. It consists of device drivers and interrupt handlers to transfer information between the main memory and the disk system. The device driver can be thought of as a translator. Its input consists of low-level commands. Its output consists of low-level hardware-specific instructions that are used by the hardware controller, which interfaces the I/O device to the rest of the system.

8 Keyword Device communicates through port A bus is a set of wires used to connect devices in a computer system A controller is a collection of electronics that can operate a port, a bus or a device

9 Buffering A buffer is a memory area that stores data while they are transferred between two devices or between a device and an application

10 Why buffer? 1. Cope with a speed mismatch between the producer and consumer of a data stream E.g. buffer is created in main memory to accumulate the bytes received from the modem Since the disk write is not instantaneous and the modem still needs a place to store additional incoming data two buffers are used. After the modem fills the first buffer, the disk write is requested. The modem then starts to fill the second buffer while the first buffer is written to disk. By the time the modem has filled the second buffer, the disk write from the first one should have completed, so the modem can switch back to the first buffer while the disk writes the second one.(double buffering)

11 Why buffer? 2. To adapt between devices that have different data-transfer sizes E.g. Networking: buffers are used widely for fragmentation and reassembly of messages. Large message: fragmented to small packets. Receive side: use buffer place them

12 Why buffers? 3. Support copy semantics for application I/O. E.g. Suppose that an application has a buffer of data that it wishes to write to disk (use write() system call) On that time, if the application changes the content of buffer, an error may occur! (since the change occurs AFTER the system call) With copy semantics, OS guarantee the copy semantics is for the write() system call. That is, the disk write is performed from the kernal buffer, so that subsequent changes to the application buffer have no effect

13 Caching A cache is a region of fast memory that holds copies of data. E.g. the instructions of the currently running process are stored on disk, cached in physical memory, and copied again in the CPU’s secondary and primary caches. The difference between a buffer and a cache is that a buffer may hold the only existing copy of a data item, whereas a cache, by definition, just holds a copy on faster storage of an item that resides elsewhere.

14 Spooling and Device reservation A spool is a buffer that holds output for a device, such as a printer, that cannot accept interleaved data streams. E.g. many print jobs want to use the printer. Spooling is one way that OS can coordinate concurrent output. Each application’s output is spooled to a separate disk file. When an application finishes printing, the spooling system queues the corresponding spool file for output to the printer.

15 Summary – transform I/O to hardware Operations


Download ppt "Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating."

Similar presentations


Ads by Google