computer studies (al) i/o management. reference silberschatz, galvin, gagne “operating system...
DESCRIPTION
Content Overview Roles of device driver SpoolingTRANSCRIPT
![Page 1: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/1.jpg)
Computer Studies (AL)
I/O Management
![Page 2: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/2.jpg)
Reference Silberschatz, Galvin, Gagne “Operating
System Concepts 6th edition”, 2003, Wiley Stallings, “Operating Systems Internals and
Design Principles”, 2001, Prentice Hall
![Page 3: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/3.jpg)
Content Overview Roles of device driver Spooling
![Page 4: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/4.jpg)
Remark Polling, Interrupt, DMA, have already
discussed in previous chapter. Please refer to the notes of interrupt handling.
![Page 5: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/5.jpg)
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
![Page 6: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/6.jpg)
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
![Page 7: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/7.jpg)
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.
![Page 8: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/8.jpg)
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
![Page 9: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/9.jpg)
Buffering A buffer is a memory area that stores data
while they are transferred between two devices or between a device and an application
![Page 10: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/10.jpg)
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)
![Page 11: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/11.jpg)
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
![Page 12: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/12.jpg)
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
![Page 13: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/13.jpg)
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.
![Page 14: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/14.jpg)
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.
![Page 15: Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating](https://reader036.vdocuments.site/reader036/viewer/2022062302/5a4d1af77f8b9ab05998232f/html5/thumbnails/15.jpg)
Summary – transform I/O to hardware Operations