Linux:Kernel:DeviceDriver
lastmod 2018-08-17created 2015-03-084 edits
A device driver, or device controller (North Korean: jangchi gudonggi, jangchi gudong peurogeuram), is a program that runs as part of the kernel to control a specific piece of hardware or device. A device driver is programmed for each of the various input/output devices that make up a computer, and it is integrated into the kernel and run there. It is a computer program made so that higher-level computer programs can interact with computer hardware devices.
A device driver is part of the kernel, but it is integrated with the kernel in different ways: in some cases the driver's source code is included in the full kernel source from the start and compiled with it, and in others it exists as a separately compiled file (*.sys on Windows, *.o on Linux) that is loaded and integrated with the kernel at boot or when needed.
A driver usually communicates with the device through the computer bus or a communications subsystem connected to the hardware. When a calling program invokes a driver command, the driver passes the command to the device. When the device returns data to the driver, the driver passes the data back to the original calling program. Drivers are hardware-dependent and specific to an operating system. These drivers can handle the interrupts needed by asynchronous, time-dependent hardware interfaces.
A device driver usually controls the hardware by accessing the registers of the device chip, and acts as a bridge between the hardware and the programs that use peripheral devices.
On MS-DOS, the x86 machine instructions IN and OUT for controlling hardware can be used directly from applications. However, with full-fledged operating systems (the Windows NT family, the Unix family, etc.), the kernel and applications are designed and run separately. A device driver is part of the kernel and has resources and an execution model completely separate from applications.
The kernel starts at boot and ends when the computer shuts down. A device driver is a program closely tied to the hardware that controls the device. Work done in kernel space includes controlling hardware such as input/output and networking, managing computer resources such as memory, and controlling the execution of applications. Unlike the kernel, an application is loaded from storage into memory and run at the user's request. Because an application cannot control hardware directly, it accesses the kernel through system calls to use the kernel's device drivers and process data.
Firmware designed to control each peripheral device in electronic products is also classified as a device driver. Real examples of device drivers can be seen in the files under the /driver directory of the open-source Linux kernel source.
Category
See also
Favorite site
- Wikipedia (en) description of device drivers
- What is a device driver?
- [Recommended] Kernel 2.6.x device drivers
- [Recommended] LDD_Part 1. Understanding device drivers
- KLDP: Linux Device Driver Self Study
- Reading and writing in device drivers
- Joinc: Writing device drivers in the Linux kernel
- KLDP: Kernel Module Programming Guide
- KLDP: Linux Kernel Module Programming Guide (Korean translation)
- KLDP: The Linux Kernel HOWTO in Korean
- KLDP: Implementing preemptive threads