Device Management11232
Device Management11232
Additional resources may be more memory, tape drives, access to files, and so
on. If the resources are available, they can be granted, and control can be
returned to the user program; otherwise, the program will have to wait until
sufficient resources are available.
Files can be thought of as abstract or virtual devices. Thus, many of the system
calls for files are also needed for devices.
If there are many multiple users of the system, we must first request the
device, to ensure exclusive use of it. After we are finished with the device, we
must release it.
Once the device has been requested (and allocated to us), we can read, write,
and (possibly) reposition the device.
I/O CONTROL
Device Drivers
The path between the operating system and virtually all hardware not on the
computer's motherboard goes through a special program called a device
driver.
A driver helps the operating system communicate with the electrical signals from
computer hardware.
Much of a driver's function is to be the translator between the electrical signals
of the hardware subsystems and the high-level programming languages of the
operating system and application programs.
Drivers take data that the operating system has defined as a file and translate
them into streams of bits placed in specific locations on storage media, or a
series of laser pulses in a printer.
Because there are such wide differences in the hardware, there are differences in
the way that the driver programs function. Most run when the device is required,
and function much the same as any other process. The operating system will
frequently assign high-priority blocks to drivers so that the hardware resource
can be released and readied for further use as quickly as possible.
A device driver can be thought of as a translator. Its input consists of high level
commands such as retrieve block 123. Its output consists of low level
hardware-specific instructions, which are used by the hardware controller, which
interfaces the I/O device to the rest of the system. The device driver usually
writes specific bit patterns to special locations in the I/O controllers memory to
tell the controller on which device location to act and what actions to take.
PERIPHERAL CONTROL
An Operating System determines the order in which jobs are processed. A job is an
operation the processor manages. Jobs include receiving data from an input device,
processing instructions, sending information to an output, and transferring items
from storage to memory and vice versa.
Sometimes, a device may already be busy processing one job when it receives a
second job. This occurs because the processor operates at a much faster rate of
speed than peripheral devices. For example, if the processor sends five print jobs to
a printer, the printer can print only one document at a time and store as many
documents as its memory can handle.
While waiting for devices to become idle, the operating system places items in
buffers. A buffer is a segment of memory or storage in which items are
placed while waiting to be transferred from an input device or to an
output device.
The operating system commonly uses buffers with print jobs. This process is
called spooling. Spooling sends print jobs to a buffer instead of sending
them immediately to the printer.
The buffer holds the information waiting to be printed, while the printer prints from
the buffer at its own rate of speed. By spooling print jobs to a buffer, the processor
can continue interpreting and executing instructions while the printer prints.
Multiple print jobs line up in a queue in the buffer. A program called a print spooler,
intercepts print jobs from the operating system and places them in a queue.