The device driver contains all device dependent code

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: buffer to the main memory. That is, the operating system executes the interrupt service routine, which reads one byte or word at a time from the device controller's buffer and stores it in memory. Involvement of the CPU in reading and storing one byte or word at a time wastes CPU time. To free the CPU from doing this low-level work, many device controllers support direct memory access (DMA) mechanism. In this method, when the operating system writes the relevant commands-and their associated parameters into the controller's registers, the command parameters also include the memory address from/to where data is to be transferred and the number of bytes to be transferred. Now after the controller has read the data from the device into its buffer, it copies the data one byte or word at a time from its buffer into the main memory at the specified memory address without the involvement of the CPU. The device controller causes an interrupt only after the entire data has been transferred to the memory. Note that in this case when the operating system starts after the interrupt, it does not have to copy the data from the device controller's buffer to memory, since the data is already there. So it can directly continue performing the subsequent operations. Simple and Easy User Interface to I/O Devices Ease of use is an important goal of all operating systems. To meet this objective, it is important to provide simple and easy user interface to all I/O devices. This is achieved by organizing the software for using I/O devices as a series of layers, with the lower layers designed to hide the internal details of the devices from the upper layers, and the upper layers designed to present a nice, clean, uniform interface to the users. As shown in Figure 14.24, the I/O software is typically structured into the following four layers: 1. Interrupt Handlers. As mentioned above, the device controller causes an interrupt after it has completed transfer of data either from the device to its buffer (in non-DMA transfer) or from the devic...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online