Section 18.5: Device Drivers and System Calls (Frame 1)                     [     ][home][next]

Another problem that arises with peripherals is how the operating system talks to them. Though there are protocols, there are many commands that the CPU can issue to the peripheral to make it work in the desired way. Special subroutines, called device drivers, are incorporated into the operating system code to issue commands to peripherals.

For example, in UNIX the system call read() is used to get input from virtually any type of peripheral: disk drive, keyboard, tape, network controller card, etc. Once UNIX begins to do the read system call, it inspects the fd (file descriptor) number given as the first parameter and determines what type of device this is by looking into system tables. This tells it which device driver to use in issuing commands. The device driver code begins to execute and further processes the parameters and then issues low-level commands to the peripheral to accomplish the data transfer.